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

Add language aware DidYouMean functionality #944

Open
zbepi opened this issue Aug 23, 2023 · 1 comment
Open

Add language aware DidYouMean functionality #944

zbepi opened this issue Aug 23, 2023 · 1 comment

Comments

@zbepi
Copy link

zbepi commented Aug 23, 2023

It would be great to have language awareness in the stats call to Find for DidYouMean functionality.

return new ProductSearchResults 
            
{                 ProductViewModels = CreateProductViewModels(result, currentContent, filterOptions.Q),                 FacetGroups = GetFacetResults(filterOptions.FacetGroups, facetQuery, selectedfacets),                 TotalCount = result.TotalMatching,                 *DidYouMeans = string.IsNullOrEmpty(filterOptions.Q) ? null : result.TotalMatching != 0 ? null : _findClient.Statistics().GetDidYouMean(filterOptions.Q),*                 Query = filterOptions.Q,             } 
; 

The request url produced:
http://127.0.0.1:8000/kRwa9aF5uXgqvMPFpDh5LHufInfCuWps/tedd_index74640/_didyoumean?query=cucumber
responds with

{"status":"ok","hits":[
{"suggestion":"shoes","type":"editorial"}
]}

however, if tags with language are appended to the url, only the relevant results are returned:
http://127.0.0.1:8000/kRwa9aF5uXgqvMPFpDh5LHufInfCuWps/tedd_index74640/_didyoumean?query=cucumber&tags=language:sv
results with

{"status":"ok","hits":[
{"suggestion":"shoes","type":"editorial"}
]}

It would be good for clients to have examples of this.

Related jira: FIND-11732 (internal to Opti)

@telleluy
Copy link
Contributor

telleluy commented Sep 5, 2023

Addition to Zachs comment:
To add tags to the query, parameters must be appended to the GetDidYouMean call.
Like: DidYouMeans = string.IsNullOrEmpty(filterOptions.Q) ? null : result.TotalMatching != 0 ? null : _findClient.Statistics().GetDidYouMean(filterOptions.Q + "&tags=language:en"),

(do not add the tags hardcoded, written like that for clarity)

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

2 participants