-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Improve SchemaManager logic for comparing text indexes #1829
Conversation
|
||
/* Avoid a strict equality check here. The numeric type returned by | ||
* MongoDB may differ from the document index without implying that the | ||
* indexes themselves are inequivalent. */ |
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.
See #1828 (comment) for additional context.
foreach (['default_language', 'language_override', 'textIndexVersion'] as $option) { | ||
/* Text indexes will always report defaults for these options, so | ||
* only compare if we have explicit values in the document index. */ | ||
if (isset($mongoIndex[$option]) && isset($documentIndexOptions[$option]) && |
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.
isset
s can be combined to one isset($mongoIndex[$option], $documentIndexOptions[$option])
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.
I had copied this from the ['bits', 'max', 'min']
loop above. Will make the change in both places.
} | ||
|
||
/* MongoDB returns the weights sorted by field name, but we'll sort both | ||
* arrays in case that is internal behavior not be be relied upon. */ |
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.
doubled "be" :)
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.
Ah, I meant to write "to be". Good catch!
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.
Also fixed in 1.2.x: 70441ac
This will avoid rebuilding text indexes unnecessarily. Fixes doctrine#1821.
@malarzm caught this in #1829 (comment)
Please ignore the |
Summary
This is a cherry-pick of #1828 for
master
and includes various CS fixes. I also added two tests for the loose equality checks for keys/weights.