Searchkick: Searchkick 2.0 Plan

Created on 25 Aug 2016  路  2Comments  路  Source: ankane/searchkick

2.0_take3 branch

Breaking

  • [x] Remove _all field if searchable is specified
  • [x] use keyword arguments
  • [x] do not return array for load: false
  • [x] add return value for multi_search

Clean up

  • [x] clean up "private" methods in Searchkick module
  • [x] remove searchkick_create_index, clean_indices, searchkick_import, searchkick_debug

Indexing improvements

  • [x] allow reindex to be called on relation
  • [x] rename partial_reindex to reindex(:method_name)

Remove old options / methods

  • [x] replace select with select_v2
  • [x] replace merge_mappings option with default_mappings
  • [x] remove query and json search options (use body instead)
  • [x] remove include option (use includes instead)
  • [x] removed personalize option (use boost_where instead)
  • [x] remove partial option (use operator instead)
  • [x] remove legacy autocomplete option
  • [x] remove facets (as we now have aggs)
  • [x] drop support for ES 1
  • [x] remove old ReindexJob

Maybe

  • [ ] Require fields to marked as searchable (or provided in the query)
  • [ ] rename searchkick_index to search_index
  • [ ] lazy searching by default (unsure if we want this)
  • [ ] remove searchkick_index_options (replace with mappings proc)
  • [ ] default to misspellings: {below: 5}
  • [ ] removed latitude and longitude swap if passing coodinates as an array

Non-breaking (can come after release)

  • [x] add debug option to search method
  • [x] add support for partial reindexes
  • [x] add retry to class reindex method
  • [ ] new where syntax with underscores - _gt, _lt, etc
  • [ ] add ReindexBatchJob to support bulk reindex
  • [ ] warn if you try to index an id field in search_data
  • [ ] warn if body and conflicting options, like where

Comments welcome!

help wanted

All 2 comments

All of your proposed changes look good! I have a suggestion, but I don't know if it's warranted.

When reindexing associations, e.g. with a callback:

after_commit :reindex_associations

def reindex_associations
    users.each { |u| u.reindex }
    whatever.each { |w| w.reindex }
end

the above gets repetitive with the each call, especially if you have models with a lot of associations that need reindexing. Would it be possible/make sense to add the reindex method to the collection? So instead it would be:

after_commit :reindex associations

def reindex_associations
    users.reindex
    whatever.reindex
end

The collection's reindex method would implicitly call each itself to reindex individual items, allowing cleaner code for searchkick clients. Does this make sense to implement?

Just out of curiosity, what would replace facets? If nothing, is there a particular reason for them getting dropped?

EDIT: I didn't realize how old my version was and I just read the documentation on moving to aggs. Thanks for that.

Was this page helpful?
0 / 5 - 0 ratings