Swapping searchableAttributes
shouldn't trigger a reindexing
#4484
Labels
performance
Related to the performance in term of search/indexation speed or RAM/CPU/Disk consumption
settings diff-indexing
Issues related to settings diff-indexing
Related product team resources: PRD (internal only)
Summary
This issue is a subset of the work implementing the settings diff-indexing enhancement.
The
searchableAttributes
order is essential in Meilisearch to rank documents matching in different attributes. For instance, a document matching in the title is ranked better than a document matching in the description.In the current implementation, the ranks are hardcoded in the searchable databases as
fieldid-word-docids
, where thefieldid
is both the ID and the rank of the field. This forces Meilisearch to reindex, or at least swap, the data in all the fieldid-based databases.The ID and the rank should be de-correlated, and a structure mapping the fieldid to its rank should be created.
This way, swapping two searchable attributes will only swap ranks in the
fieldid-rank
mapping table and no more reindexing will be needed.TODO
searchableAttributes
swapping is tested in Meilisearchfieldid-rank
mapping tableAttributes
criterion takes into account thefieldid-rank
mapping tablesearchableAttributes
are only swappeddocuments
databaseRelated Benchmarks:
settings-remove-add-swap-searchable.json
Additional note from @ManyTheFish
I raised the priority of this issue because fixing it will ease several implementations. Today, the field mapping with the fields is unstable, which means that changing the searchable attributes settings can change this mapping, forcing reindexing data that don't need to just because their related field changed.
For instance indexing a document like:
with the settings:
Should assign the field ids like
"name": 0, "id": 1, "age": 2, "realName": 3
.And then, changing the settings to:
Should assign the field ids like
"name": 0, "realName": 1, "id": 2, "age": 3
.forcing the reindexing of 3 fields just by adding a searchable attribute.
The text was updated successfully, but these errors were encountered: