wagtail-nest / wagtail-whoosh

Search backend for Wagtail CMS using Whoosh engine.
24 stars 8 forks source link

Index changes #5

Closed seb-b closed 5 years ago

seb-b commented 5 years ago

Relies on #3, #4 and fixes #2

There's a lot of changes here but hopefully I can break down what's happening. The original way that everything was indexed was to create one super file index that held every document and all the searchable content in one field in the document. The changes here breaks up that index into different indexes based on the model being indexed, and it's parent models. i.e. HomePage models are indexed in the HomePage index and the Page index.

This allows individual schemas to be set up per model-index pair which allows for boosts to be set up on a per-field basis. When a search is done over the Page model it also searches all it's descendant models, similar to before but over different indexes.

Some other low-effort features were added for parity such as changing the operator and specifying fields.

This change does break faceted searching, but it will be possible to bring back. It looks like the code was just using the DatabaseBackend's methods anyway.

There's a few TODO's and FIXME's but I believe this is a step in the right direction.