README.md in pursuit-0.1.1 vs README.md in pursuit-0.2.0
- old
+ new
@@ -18,12 +18,26 @@
You can use the convenient DSL syntax to declare which attributes and relationships are searchable:
```ruby
class Product < ActiveRecord::Base
- has_search relationships: { variations: %i[title] },
- keyed_attributes: %i[title description rating],
- unkeyed_attributes: %i[title description]
+ searchable do |o|
+ o.relation :variations, :title, :stock_status
+
+ o.keyed :title
+ o.keyed :description
+ o.keyed :rating
+
+ # You can also create virtual attributes to search by passing in a block that returns an arel node.
+ o.keyed :title_length do
+ Arel::Nodes::NamedFunction.new('LENGTH', [
+ arel_table[:title]
+ ])
+ end
+
+ o.unkeyed :title
+ o.unkeyed :description
+ end
end
```
This creates a ```.search``` method on your record class which accepts a single query argument: