ankane/searchkick — pull request #317 by subvertallchris (2014-11-01 19:49:48+00:00)
Title: Separate DB query logic, make it easy to add custom behavior

Let's try this again! :-)

If someone wants to add a custom DB query, they shouldn't have to override the entire `result`` method. This separates out all of the database logic into its own method. It also adds a `custom_query` method as the `else` case instead of the Mongoid 3+ query.

If someone is not already overriding the behavior and they're not using a DB compatible with the existing query logic, they'll get a more descriptive error than `undefined method queryable`. If they do have a custom need, they can write their own `custom_query` like this:

```ruby
module Searchkick
class Results
def custom_query(records, grouped_hits)
records.array_load(grouped_hits.map { |hit| hit['_id'].to_i })
end
end
end
```