Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the isIndexEqual function to take into account non-text index… #13138

Merged
merged 3 commits into from
Mar 13, 2023

Conversation

rdeavila94
Copy link
Contributor

@rdeavila94 rdeavila94 commented Mar 6, 2023

…es when checking compound indexes that include both text and non-text indexes

Summary

This PR fixes #13136

@@ -28,15 +28,19 @@ module.exports = function isIndexEqual(key, options, dbIndex) {
// textIndexVersion: 3
Copy link
Contributor Author

@rdeavila94 rdeavila94 Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A compound index with text and non-text fields will look like this:
{ name: 'text', age:1 } becomes:

   {
     v: 2,
     key: { _fts: 'text', _ftsx: 1, age: 1 },
     name: 'name_text_age_1',
     ns: 'test.tests',
     background: true,
     weights: { name: 1 },
     default_language: 'english',
     language_override: 'language',
     textIndexVersion: 3
   }

Currently, we are comparing the weights agains the entire key set, here

But the key arg into this function consists of ALL the keys, whereas the weights only include the text-indexed keys.

Screen Shot 2023-03-06 at 9 33 24 AM

…es when checking compound indexes that include both text and non-text indexes
@vkarpov15 vkarpov15 added this to the 5.13.17 milestone Mar 7, 2023
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@vkarpov15 vkarpov15 merged commit 5dd0a4e into Automattic:5.x Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants