Skip to content

Commit

Permalink
order search results desc
Browse files Browse the repository at this point in the history
  • Loading branch information
colinyoung87 committed Jul 31, 2015
1 parent 2378556 commit 414c927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def create
def show
@query = params[:id]
@results = PgSearch.multisearch(@query)

render json: @results
end

private
Expand Down
3 changes: 2 additions & 1 deletion config/initializers/pg_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
:using => {
:tsearch => {:prefix => true, :dictionary => "english"},
:trigram => {}
}
},
:order_within_rank => "updated_at DESC"
}

0 comments on commit 414c927

Please sign in to comment.