Limit the reindexing caused by updating settings when not needed #706
Limit the reindexing caused by updating settings when not needed #706
Conversation
For my logic in pub(crate) fn delete_all_searchable_fields(&self, wtxn: &mut RwTxn) -> heed::Result<bool> {
self.delete_searchable_fields(wtxn)?;
self.delete_user_defined_searchable_fields(wtxn)
} To clarify, I am not sure if this should actually return (for example): pub(crate) fn delete_all_searchable_fields(&self, wtxn: &mut RwTxn) -> heed::Result<bool> {
Ok(self.delete_searchable_fields(wtxn)? && self.delete_user_defined_searchable_fields(wtxn)?)
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your changes, it looks amazing indeed, it will speedup a lot of workflows where users were always sending the searchable attributes ❤️
^^ Don't know why GitHub removed that request for review from @ManyTheFish. I only requested a re-review from @Kerollmops. I don't have the permission necessary to request a review either so sorry about that. |
The delete functions should be mapped on the LMDB So the short answer is: yes, the delete_* methods must return |
Cases: whenever searchable_fields OR user_defined_searchable_fields is modified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you've done looks good to me. I'll wait for you to answer @irevoire and would like to know what @irevoire thinks of merging this now or waiting for @loiclec to fix the issue of the duplicated and Missing key in the documents database bug. It would be safer to wait for the fix, but I am also quite happy if we could provide that to the users in v0.30.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it looks good to me as well.
I'm not sure we want to push this change in the v0.30.1 since it's not a bug fix, though 😱
What do you think @curquiza?
It looks pretty safe to me, but it's typically the kind of thing we said we would not do 😂
Discussed internally here: #707 is safe to be integrated into v0.30.1. We will merge it right after v0.30.1 release, thanks @GregoryConrad! 😊 |
@curquiza Thanks for the update! Just as a heads up, please hold off on merging this until I get a chance to address this. I need to experiment with the index's current behavior to see if I might be able to throw in another optimization (or if it is good as-is). Edit: my test went a lot faster than I thought I would. You're all set to merge at your convenience! |
We can merge this PR to main finally, because other PRs have been merged into bors merge |
What does this PR do?
When updating index settings using
update::Settings
, sometimes areindex
ofupdate::Settings
is triggered when it doesn't need to be. This PR aims to prevent those unnecessaryreindex
calls.For reference, here is a snippet from the current
execute
method inupdate::Settings
:faceted_updated
- looks good as-is ✅stop_words_updated
- looks good as-is ✅synonyms_updated
- looks good as-is ✅searchable_updated
- fixed in this PRexact_attributes_updated
- fixed in this PRPR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!