-
Notifications
You must be signed in to change notification settings - Fork 45
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
Bugfix: autocomplete suggests nonsearchable terms #102
Bugfix: autocomplete suggests nonsearchable terms #102
Conversation
Thanks very much for the PR! I'll test it out today :) |
updated unitest, please check again |
To check my understanding of the situation:
Is that correct? |
@rhoerr that's correct
There might be a way to retrieve the searchable flag by adding a dependency, but adding this flag to the field mapping is more natural and reliable to me. |
app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/AttributeAdapter.php
Outdated
Show resolved
Hide resolved
I just ran
Commenting out
and
in Do you have an idea? |
Yes I was able to replicate the error. I thought the FieldProvider class I modified is a provider for in-memory mapping, turns out it is also used to build mapping for index, and we can not introduce a random property 'isSuggestible' just like that, opensearch won't take it. If there is no way to get My initial thought was to change
as it seems to me developers mixed up 'searchable' and 'indexible' overtime, but that might be a backward incompatible change. |
Oh boy, mixing concerns indeed. I'm sorry I'm not familiar enough with the code to provide ideas for sensible workarounds. That said, I trust your technical prowess :) |
PR updated, please review |
app/code/Magento/Elasticsearch/Model/DataProvider/Base/Suggestions.php
Outdated
Show resolved
Hide resolved
I requested small constructor changes for backwards compatibility, but otherwise it looks good to me. It's much less likely to cause problems with your refactor, thanks for doing that. |
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.
Besides the change request from @rhoerr to the constructor parameters, I have tested it and can confirm it works as intended! Also, setup:upgrade works again, too.
Thank you very much!
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.
Looks good to me! Thank you
I believe the unit test failures are unrelated and a result of the in-progress upstream transition to PHPUnit 10. Since Vinai tested and approved other than the constructor change that is now done, I'm going to go ahead and merge this. |
@rhoerr I think it is still related to unit test for this change. I thought Suggestions is not a unitest covered class as I don't see unit test of this class in elasticsearch module, but it is actually in the elasticsearch7/opensearch module, we will have to look into those tests |
* added additional check to ensure autocomplete suggests only searchable terms --------- Co-authored-by: Ryan Sun <[email protected]>
* Bugfix: autocomplete suggests nonsearchable terms (#102) * added additional check to ensure autocomplete suggests only searchable terms --------- Co-authored-by: Ryan Sun <[email protected]> * Update unit test for autocomplete suggests fix (#104) * added additional check to ensure autocomplete suggests only searchable terms * updated unitest for search suggest fix * added type casting for isSuggestible * reverted suggestible flag and fixed getSuggestFields method * updated suggest contructor params to avoid bic * updated unit test with new dependency productAttributeCollectionFactory for Suggestions * add fieldProvider back to Suggestions constructor --------- Co-authored-by: Ryan Sun <[email protected]> --------- Co-authored-by: Ryan Sun <[email protected]> Co-authored-by: Ryan Sun <[email protected]>
Description (*)
Since 2.4.7 we noticed search autocomplete would suggest search terms with no result.
here are some more cases of bad search suggestions with sample data package :
Intending to search for "Didi Sports Watch"
"didi" -> suggestion "duti" with no matches
Intending to search for "Bottle"
"bot" -> suggestion for "but" and "boi", the latter bringing no search results
Intending to serach for "Summit
"summ" -> suggestion "seam" and "sued" which bring results but not the watch
Manual testing scenarios (*)
Contribution checklist (*)