forked from OpenNeo/impress
instead of returning an empty item list on contradiction, return an empty proxy collection
This commit is contained in:
parent
daf1f140fb
commit
4c208c9ac3
2 changed files with 3 additions and 9 deletions
|
@ -14,7 +14,7 @@ class ItemsController < ApplicationController
|
||||||
# Note that we sort by name by hand, since we might have to use
|
# Note that we sort by name by hand, since we might have to use
|
||||||
# fallbacks after the fact
|
# fallbacks after the fact
|
||||||
@items = Item::Search::Query.from_text(@query, current_user).
|
@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!
|
assign_closeted!
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Item
|
||||||
rescue Item::Search::Contradiction
|
rescue Item::Search::Contradiction
|
||||||
# If we have a contradictory query, no need to raise a stink about
|
# If we have a contradictory query, no need to raise a stink about
|
||||||
# it, but no need to actually run a search, either.
|
# it, but no need to actually run a search, either.
|
||||||
return []
|
return Item.build_proxies([])
|
||||||
end
|
end
|
||||||
|
|
||||||
final_flex_params = {
|
final_flex_params = {
|
||||||
|
@ -94,13 +94,7 @@ class Item
|
||||||
|
|
||||||
result = FlexSearch.item_search(final_flex_params)
|
result = FlexSearch.item_search(final_flex_params)
|
||||||
|
|
||||||
if options[:as] == :proxies
|
|
||||||
result.proxied_collection
|
result.proxied_collection
|
||||||
else
|
|
||||||
result.scoped_loaded_collection(
|
|
||||||
:scopes => {'Item' => Item.includes(:translations)}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Load the text query labels from I18n, so that when we see, say,
|
# Load the text query labels from I18n, so that when we see, say,
|
||||||
|
|
Loading…
Reference in a new issue