dada
Jun 24, 2020
  12602
(4 votes)

Improving synonyms and overall search experience

Is your Search & Navigation (Find) implementation affected by the limitations of the current synonym functionality and/or would you like to improve upon the overall search experience? 

Check out https://github.com/episerver/EPiServer.Labs.Find.Toolbox
Setup and configuration is simple. Install NuGet Package and then there are a couple of lines of code to get it working.

What you get

  • An improved synonym implementation (No more issues with synonyms in conjuction with .WithAndAsDefaultOperator)
  • An overall relevance improvement by utilising MatchPhrase, MatchPhrasePrefix and MatchPrefix
  • Support for MinimumShouldMatch which improves search experience further
  • FuzzyMatch and WildcardMatch improving searches with typos and partial words

All can be used together or independently and depends on the .For() call for the original query

Full details available in README 
https://github.com/episerver/EPiServer.Labs.Find.Toolbox/blob/master/README.md

Feedback and input are welcome and don't hesitate to contribute if you'd like.

Please note that this project is not officially supported by Episerver just like most EPiServer.Labs projects.
Should be considered stable and is currently used in production environments.

UPDATE 2021-01-09
New version 1.1.1.
Bugfix for bidrectional multi term synonyms
Boost adjustment for PrefixQueries

UPDATE 2020-10-14
New version 1.1.0.
Further improvements to relevance with the addition of .UsingRelevanceImprove()
which combines the powers of Elastic Search's MatchPhrase, MatchPhrasePrefix and MatchPrefix.

UPDATE 2020-09-08
Bugfixes and improvements and new version 1.0.9.

UPDATE 2020-09-03
Project renamed to Find Toolbox @ https://github.com/episerver/EPiServer.Labs.Find.Toolbox
Now with new features to improve search relevance and overall search experience even further. 




Jun 24, 2020

Comments

Tomas Hensrud Gulla
Tomas Hensrud Gulla Jun 25, 2020 08:41 AM

Can this be made available at https://nuget.episerver.com/ ?

Tomas Hensrud Gulla
Tomas Hensrud Gulla Jun 25, 2020 08:52 AM

I have tried (both including the source code, and installing the nuget package), but are experiencing a problem.

My code:

SearchClient.Instance.UnifiedSearch(language).For(model.Query).UsingSynonymsImproved();

Build error:
Error CS1061 'IQueriedSearch<ISearchContent, QueryStringQuery>' does not contain a definition for 'UsingSynonymsImproved' and no extension method 'UsingSynonymsImproved' accepting a first argument of type 'IQueriedSearch<ISearchContent, QueryStringQuery>' could be found (are you missing a using directive or an assembly reference?)

I have both the reference and the using directive.

dada
dada Jun 25, 2020 11:27 AM

Hi Tomas,

Please make sure you have. 

using EPiServer.Find.Cms;

If I don't have it I get the same error message. I have updated the README to reflect this.

dada
dada Jun 25, 2020 01:11 PM

Tomas, I will discuss with dev team if we can make it available from nuget.episerver.com after the summer.

Tomas Hensrud Gulla
Tomas Hensrud Gulla Jun 26, 2020 09:50 AM

The problem was not the using-statement, but the lack of suppoert for .NET 4.6.1.

Thanks for fixing  it so quick! Excellent work!

Tomas Hensrud Gulla
Tomas Hensrud Gulla Jun 26, 2020 09:50 AM

The problem was not the using-statement, but the lack of support for .NET 4.6.1.

Thanks for fixing  it so quick! Excellent work!

Michael Clausing
Michael Clausing Jun 26, 2020 06:22 PM

This looks very similar to what we talked about doing for a client. Thanks!

Mari Jørgensen
Mari Jørgensen Jul 6, 2020 05:15 PM

@dada This should work for filtered search as well?

I have code similar to this (simplified a bit):

SearchClient.Instance.Search<EntryContentBase>(Language.Norwegian)
.For(searchQuery)
.InField(x)
.InField(y)
.InField(z)
.MinimumShouldMatch("2<60%")
.UsingSynonymsImproved()
.ApplyBestBets()

I cannot get any results for multi words synonyms.

dada
dada Jul 8, 2020 08:02 PM

@Mari if you could share index details and JSON for that search I will look into it. Send it directly to my email daniel.dahlin@episerver.con

Mari Jørgensen
Mari Jørgensen Aug 5, 2020 08:18 AM

@dada: Back from vaction. Email is coming in next couple of minutes.

Eric Petersson
Eric Petersson Aug 6, 2020 07:33 AM

I have the same issues when trying to get hits on bidirectional synonyms via the UsingImprovedSynonyms()

dada
dada Aug 6, 2020 10:14 AM

Hi @Mari @Eric

By the looks of JSON for search shared by Mari it looks like the match is never made which likely because the local synonym list is cached and which lacks the additional synonym. Also empty lists are cached to avoid spamming the service with requests.

Testing multi term synonyms and bidirectional synonyms works locally.

By default the list is cached for an hour. When testing you could set it to something lower like .UsingImprovedSynonyms(TimeSpan.FromSeconds(10))

Mari Jørgensen
Mari Jørgensen Aug 6, 2020 11:26 AM

I can confirm that caching is the issue! Went back to the branch and tested once more, and now it works! Thanks, Daniel!

Suha Alshami
Suha Alshami Nov 9, 2020 09:29 AM

Hi,

I cant install EPiServer.Labs.Find.Toolbox from the nuget package, how to find it ?

Tomas Hensrud Gulla
Tomas Hensrud Gulla Nov 9, 2020 09:32 AM

@Suha: you could download the .nupkg file from the GitHub repo.

Suha Alshami
Suha Alshami Nov 9, 2020 09:36 AM

Thank you Tomas, which one of them ?

dada
dada Nov 9, 2020 09:41 AM

Hi @Suha: 1.1.0 is the latest. I would suggest you go with this one because of the improvements it comes with.

Tomas Hensrud Gulla
Tomas Hensrud Gulla Nov 9, 2020 09:41 AM

The newest one, I guess: EPiServer.Labs.Find.Toolbox.1.1.0.nupkg

Suha Alshami
Suha Alshami Nov 9, 2020 09:48 AM

I will go with the newest one.
Thank you @dada and @Tomas

Suha Alshami
Suha Alshami Nov 10, 2020 09:07 AM

I imported the source code and installed the nuget package and I got the following error ?

QueriedSearch<ISearchContent, QueryStringQuery>' does not contain a definition for 'UsingSynonymsImproved'

dada
dada Nov 10, 2020 09:12 AM

Hi @Suha

You should only need the nuget package. Please share the full code using UsingSynonymsImproved(). What version of .NET is your solution compiled for?

Suha Alshami
Suha Alshami Nov 10, 2020 02:58 PM

Hi @dada

It targets .NET Framwork 4.7.2

Here how the code looks like:

Suha Alshami
Suha Alshami Nov 10, 2020 03:04 PM

Hi again,

I added EPiServer.Labs.Find.Toolbox.1.1.0.nupkg directly to my project under the root. 

Suha Alshami
Suha Alshami Nov 10, 2020 03:18 PM

This is what I get back after trying to install it from nuget package.

dada
dada Nov 10, 2020 03:56 PM

Hi @Suha

It looks like the package is not installed. 

http://packagesource is not a likely valid source, right?

Suha Alshami
Suha Alshami Nov 11, 2020 08:16 AM

Hi @dada

Thats right, was wrong path, thanks!

Suha Alshami
Suha Alshami Nov 11, 2020 10:39 AM

I have the following code and I cannot get any results for multi words synonyms, I am missing something maybe?

dada
dada Nov 11, 2020 10:41 AM

Hi @Suha

Set the cache duration to something really low when testing. Default is 3 hours.

 .UsingSynonymsImproved([cacheDuration]) 

Suha Alshami
Suha Alshami Nov 11, 2020 12:24 PM

Hi @dada

Works nice! 

dada
dada Nov 11, 2020 12:25 PM

@Suha Glad to hear!

Suha Alshami
Suha Alshami Nov 18, 2020 10:29 AM

How doese synoyms works when the fras and synoyms is in the searchlist or must the fras be something which doesnt give a search results ? 

dada
dada Nov 19, 2020 04:40 PM

Hi @Suha

Phrase could be something that exist in the index but it doesn't have to.

If it exists in the index you will as expected get hits on both the phrase and the synonym that the phrase matches. 

Scott Reed
Scott Reed Oct 3, 2024 09:21 AM

Do you know if anyone has anything working for CMS 12 and .NET Core? I can look at the package myself but just checking as we are experiencing this problem

Daniel Dahlin
Daniel Dahlin Oct 3, 2024 01:58 PM

Hi Scott

I put it in the net branch

https://github.com/episerver/EPiServer.Labs.Find.Toolbox/blob/net/packages/EPiServer.Labs.Find.Toolbox.2.0.1.nupkg

Please login to comment.
Latest blogs
Copy Optimizely SaaS CMS Settings to ENV Format Via Bookmarklet

Do you work with multiple Optimizely SaaS CMS instances? Use a bookmarklet to automatically copy them to your clipboard, ready to paste into your e...

Daniel Isaacs | Dec 22, 2024 | Syndicated blog

Increase timeout for long running SQL queries using SQL addon

Learn how to increase the timeout for long running SQL queries using the SQL addon.

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Overriding the help text for the Name property in Optimizely CMS

I recently received a question about how to override the Help text for the built-in Name property in Optimizely CMS, so I decided to document my...

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Resize Images on the Fly with Optimizely DXP's New CDN Feature

With the latest release, you can now resize images on demand using the Content Delivery Network (CDN). This means no more storing multiple versions...

Satata Satez | Dec 19, 2024

Simplify Optimizely CMS Configuration with JSON Schema

Optimizely CMS is a powerful and versatile platform for content management, offering extensive configuration options that allow developers to...

Hieu Nguyen | Dec 19, 2024

Useful Optimizely CMS Web Components

A list of useful Optimizely CMS components that can be used in add-ons.

Bartosz Sekula | Dec 18, 2024 | Syndicated blog