README.md in solidus_searchkick-0.2.3 vs README.md in solidus_searchkick-0.3.0

- old
+ new

@@ -108,10 +108,14 @@ ... filters end ``` +Advanced Filtering +------------------ +Checkout out the wiki page [here](https://github.com/elevatorup/solidus_searchkick/wiki/Advanced-Filtering). + Autocomplete ------------ By default, SolidusSearchkick provides autocomplete for the `name` field of your products. In order to get this working, all you need to do is add the following lines to the corresponding files: application.js @@ -145,10 +149,22 @@ end ... end ``` +Fields and Boosting +------------------- +With SolidusSearchkick, you can include a list of fields that you would like to search on. This list can also include boosted fields the same way that Searchkick can. You can learn more about Searchkick boosting [here](https://github.com/ankane/searchkick#boosting). + +In order to add the fields, pass in an array of the fields: + +``` +fields = ['name^99', :description, ...] +searcher = build_searcher(params.merge(fields: fields)) +@products = searcher.retrieve_products +``` + Searchkick Options ------------------ Since SolidusSearchkick uses Searchkick to interact with ElasticSearch, it also accepts all of the Searchkick options. You can specify a limit or offset when searching, as well as any other options provided by Searchkick. @@ -203,49 +219,10 @@ searcher = build_searcher(query: query) @products = searcher.retrieve_products ``` -Overriding and Extending Default Methods ----------------------------------------- - -By creating an initializer, you have the ability to override or extend any of the default methods provided by SolidusSearchkick. - -### Overriding a Default Method - -In order to override a method, simply add that method to the initializer. - -_(Take care when overriding methods, as you may loose some functionality if not careful)_ -``` -# config/initializers/solidus_searchkick.rb -Spree::Search::Searchkick.class_eval do - def where_clause - # Default items for where_clause - where_clause = { - active: true - } - where_clause.merge!({taxon_ids: taxon.id}) if taxon - - # Add search attributes from params[:search] - add_search_attributes(where_clause) - end -end -``` - -### Extending a Default Method - -In order to extend a method, alias the original method, then call the aliased method when defining the new method. -``` -# config/initializers/solidus_searchkick.rb -Spree::Search::Searchkick.class_eval do - alias_method :original_where_clause, :where_clause - def where_clause - original_where_clause.merge(param1: param1, param2: param2) - end -end -``` - Testing ------- First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`. @@ -266,5 +243,14 @@ Special Thanks -------------- SolidusSearchkick was heavily inspired by [spree_searchkick](https://github.com/ronzalo/spree_searchkick), which was used as a starting point to getting Solidus to work nicely with Searchkick. + +Contributing +------------ + +1. Fork it ( https://github.com/elevatorup/solidus_searchkick/fork ) +2. Create your feature branch (`git checkout -b feature/my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin feature/my-new-feature`) +5. Create a new Pull Request