Skip to content

Commit

Permalink
Sort by score
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Dec 22, 2016
1 parent 1a74f29 commit 1fdb41a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/documents_controller.rb
Expand Up @@ -8,7 +8,12 @@ def index
@tag = params[:tag]

searcher = DocumentsSearcher.new
request = searcher.search.query(@query)
request = searcher.search
if @query.present?
request = request.
query(@query).
sort_keys("-_score")
end
if @tag.present?
request = request.filter("tags @ %{tag}", tag: @tag)
end
Expand Down

0 comments on commit 1fdb41a

Please sign in to comment.