1
0
Fork 0
forked from OpenNeo/impress

instead of returning an empty item list on contradiction, return an empty proxy collection

This commit is contained in:
Emi Matchu 2013-07-03 18:17:16 -07:00
parent daf1f140fb
commit 4c208c9ac3
2 changed files with 3 additions and 9 deletions

View file

@ -14,7 +14,7 @@ class ItemsController < ApplicationController
# Note that we sort by name by hand, since we might have to use
# fallbacks after the fact
@items = Item::Search::Query.from_text(@query, current_user).
paginate(page: params[:page], per_page: per_page, as: :proxies)
paginate(page: params[:page], per_page: per_page)
assign_closeted!
respond_to do |format|
format.html {

View file

@ -35,7 +35,7 @@ class Item
rescue Item::Search::Contradiction
# If we have a contradictory query, no need to raise a stink about
# it, but no need to actually run a search, either.
return []
return Item.build_proxies([])
end
final_flex_params = {
@ -94,13 +94,7 @@ class Item
result = FlexSearch.item_search(final_flex_params)
if options[:as] == :proxies
result.proxied_collection
else
result.scoped_loaded_collection(
:scopes => {'Item' => Item.includes(:translations)}
)
end
end
# Load the text query labels from I18n, so that when we see, say,