出于某种原因,我的太阳黑子正在返回重复值。可能是什么原因?
这是我的搜索块:
@search = Item do |query|
query.with :menu_ids, @menu.id
query.with :public, true
case @type
when "popularity"
query.order_by :popularity, :desc
when "store"
query.with :store_id, @stores.map(&:id)
when "special"
query.with :special, true
end
query.order_by :published_at, :desc
if @tag
query.fulltext @tag
end
query.with :price, @filters[:low]..@filters[:high] if @filters[:low] && @filters[:high]
query.with :state, 'published'
end
@items = @search.results
我收到30件物品,但其中6件是重复的。