Commit 3104b3a14b49622350b64bf79669bbdf8b72ed84

Authored by Andrew Kane
1 parent e028b9ba

Updated readme

Showing 1 changed file with 5 additions and 7 deletions   Show diff stats
README.md
... ... @@ -241,7 +241,7 @@ Available options are:
241 241 ### Exact Matches
242 242  
243 243 ```ruby
244   -User.search "hi@searchkick.org", fields: [{email: :exact}, :name]
  244 +User.search params[:q], fields: [{email: :exact}, :name]
245 245 ```
246 246  
247 247 ### Language
... ... @@ -488,14 +488,14 @@ First, specify which fields use this feature. This is necessary since autocompl
488 488  
489 489 ```ruby
490 490 class City < ActiveRecord::Base
491   - searchkick text_start: [:name]
  491 + searchkick match: :word_start
492 492 end
493 493 ```
494 494  
495 495 Reindex and search with:
496 496  
497 497 ```ruby
498   -City.search "san fr", fields: [{name: :text_start}]
  498 +City.search "san fr", fields: [:name]
499 499 ```
500 500  
501 501 Typically, you want to use a JavaScript library like [typeahead.js](http://twitter.github.io/typeahead.js/) or [jQuery UI](http://jqueryui.com/autocomplete/).
... ... @@ -507,11 +507,9 @@ First, add a route and controller action.
507 507 ```ruby
508 508 # app/controllers/cities_controller.rb
509 509 class CitiesController < ApplicationController
510   -
511 510 def autocomplete
512   - render json: City.search(params[:query], fields: [{name: :text_start}], limit: 10).map(&:name)
  511 + render json: City.search(params[:query], fields: [:name], limit: 10).map(&:name)
513 512 end
514   -
515 513 end
516 514 ```
517 515  
... ... @@ -536,7 +534,7 @@ Then add the search box and JavaScript code to a view.
536 534  
537 535 ```ruby
538 536 class Product < ActiveRecord::Base
539   - searchkick suggest: ["name"] # fields to generate suggestions
  537 + searchkick suggest: [:name] # fields to generate suggestions
540 538 end
541 539 ```
542 540  
... ...