Commit c66b0e520a6677e7a149edbbfebcc2838bed5402
1 parent
4e148ff0
Exists in
master
and in
21 other branches
Better autocomplete example
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
README.md
... | ... | @@ -543,7 +543,7 @@ First, specify which fields use this feature. This is necessary since autocomple |
543 | 543 | |
544 | 544 | ```ruby |
545 | 545 | class Book < ActiveRecord::Base |
546 | - searchkick match: :word_start, searchable: [:title, :author] | |
546 | + searchkick word_start: [:title, :author] | |
547 | 547 | end |
548 | 548 | ``` |
549 | 549 | |
... | ... | @@ -565,6 +565,7 @@ class BooksController < ApplicationController |
565 | 565 | def autocomplete |
566 | 566 | render json: Book.search(params[:query], { |
567 | 567 | fields: ["title^5", "author"], |
568 | + match: :word_start, | |
568 | 569 | limit: 10, |
569 | 570 | load: false, |
570 | 571 | misspellings: {below: 5} | ... | ... |