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

Suggestion filtering hides synonyms #29

Open
focusaurus opened this issue Jan 23, 2019 · 4 comments
Open

Suggestion filtering hides synonyms #29

focusaurus opened this issue Jan 23, 2019 · 4 comments

Comments

@focusaurus
Copy link

I've enabled synonym support in my elasticsearch, which means, for example, end users might search for "trousers" and get back results that do not contain "trousers" but do contain "pants". I think that getSuggestions is hiding these results. Have you put any thought into this scenario? I think I understand what the filtering here is trying to do, which is handle when the user has changed their search term by the time results come back ( right? ), but in my case it's hiding results I'd still like to see.

@siddharthlatest
Copy link
Member

@focusaurus This is a good point. The filtering is there to get distinct suggestions, however the way it currently is being set, it would not show synonyms. I don't have an answer atm on what would be the best way to handle this, open to suggestions.

@siddharthlatest
Copy link
Member

@focusaurus This should actually be possible, can you try using https://opensource.appbase.io/reactive-manual/advanced/customsuggestions.html?

@willopez
Copy link

@siddharthlatest I have implemented your suggestion, and the synonyms still get filtered out. And that is because, getSuggestions will have already been called by the time custom suggestions rendering executes. This line is redundant, https://github.com/appbaseio/reactivecore/blob/master/src/utils/suggestions.js#L30, Elasticsearch will have already search for a match, and it's not taking into consideration synonyms, which Elasticsearch does.

@siddharthlatest
Copy link
Member

@willopez Is the above comment still relevant? With v3.0, we pass rawData which would contains the unparsed suggestions. I saw the related PR here, but the currentValue based match is an important filter to remove duplicates (when your data may not contain distinct values) and in most scenarios is a good default. Removing that isn't a good idea.

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

No branches or pull requests

3 participants