WithAndAsDefaultOperator() does not work as expected with UsingSynonyms()

Vote:
 

I have created a 'one way' synonym as “dog” > "animal”.

  • When I search for "test+dog" it gives many results. (Which is as expected)
  • When I search for "dog+test" it gives 0 results. (Which is not as expected)

The above both queries should return the same result set (Many results) regardless of the word order.

My search implementation is like below,

search = search.For(queryText) 
        .InAllField() 
        .WithAndAsDefaultOperator() 
        .UsingSynonyms();

This issue is not reproducible when,

  • we remove the synonyms defined.
  • we remove the WithAndAsDefaultOperator() or the UsingSynonyms().

This means there is an incompatibility/issue with the UsingSynonyms() when used along with the WithAndAsDefaultOperator().

Is this a known issue ?

Note: I have found that there is an issue with multi-words synonyms and the WithAndAsDefaultOperator. But in my case, it is not about multi-word synonyms. But I do not know whether my issue is happening because of the same issue which fuels the multi-words synonyms issue.

Thanks.

#216988
Feb 12, 2020 6:46
- Feb 27, 2020 7:01
In other words, every phrase (search text) begins with the synonym I have defined in the Epi will give 0 results.

E.g.

"dog+word1+word2" - gives 0 results !

"dog" - gives many results as expected.

"word1+dog+word2" - gives many results as expected.

"word1+word2+dog" - gives many results as expected.
Vote:
 

Senura, do you have any updates on this issue?  I'm trying to get WithAndAsDefaultOperator() to work with UsingSynonyms() as well.  It's not working as expected.

#276920
Mar 22, 2022 19:52
Vote:
 

Unfortunately there are a lot of problems with Search & Navigation and synonyms.

Install this package: https://github.com/episerver/EPiServer.Labs.Find.Toolbox
It's not available in the Optimizely NuGet feed, but you'll find the package in the github repo

Then replace .UsingSynonyms() with .UsingSynonymsImproved()

Among other improvements, it should fix:

  • Missing or unexplainable hits when using .WithAndAsDefaultOperator()
#276925
Edited, Mar 22, 2022 21:12
Vote:
 

Tomas,

Thank you for the response. Since posting this, I've tried this package and like the results when using .WithAndAsDefaultOperator() (14 results).  Unfortunately when adding .UsingSynonymsImproved() it seems to give the same number of results as when not using this package (1080).

It seems like Episerver has identified this as an issue for quite some time (2 years) according to this:

https://support.optimizely.com/hc/en-us/articles/115004105823

Do you have any insight as to if Episerver is working on integrating the lab work into a supported package?

Cheers,

Mark

#277072
Mar 24, 2022 13:45
Tomas Hensrud Gulla - Mar 24, 2022 13:51
I am not aware of any plans regarding integrating the lab work, but I'm hoping...
Vote:
 

If I'm not mistaken I believe that you can go around the issue by not using InAllField, instead specify all the fields after WithAndAsDefaultOperator.

Example:

.WithAndAsDefaultOperator()

.InField(...)

.AndInField(...)

.UsingSynonyms()

#277186
Mar 25, 2022 9:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.