Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • WombleNumber1 6 posts 87 karma points
    Apr 13, 2021 @ 16:03
    WombleNumber1
    0

    Examine Search - Synonyms

    Hi All,

    I am trying to implement synonym searching in the Examine search engine that comes with Umbraco 8 out of the box.

    Does anyone have any experience with implementing synonym searching in Examine/Umbraco 8. The options that I have been considering after looking around are -

    • A package that can be installed in Umbraco 8 that offers this extended functionality (if one exists).
    • Implementing a custom index (currently just using the out of the box 'ExternalIndex') that somehow implements synonym searching in the analysis (via custom analyzer implementation etc - If that is even possible).
    • Manually formatting multiple search terms by checking for synonyms in the string beforehand, running all searches and consolidating the results after (really a nasty, last resort option - you don't have to tell me how bad this is, I already know).

    I have been trawling around the forums for a definitive answer on this and cannot really find one. Essentially I want to stick with the Examine engine for simplicity, however I am starting to think that the best way to achieve what I am after would be to move to a new engine completely (elastic search for example).

    Many thanks in advance.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Apr 17, 2021 @ 10:33
    Marc Goodson
    100

    Hi WombledNumber1

    What kind of synonyms are you hoping to search with?

    Sometimes I'll add a multiple text field to documents in Umbraco to allow editors to supply 'synonyms' or other key terms that when searched for should match the particular document (and these terms are never displayed on the site, only added to Examine index and queried with a custom search filter.

    If it's common variations of a search term you want to return then you could get some success using Examine's Fuzzy method:

    https://shazwazza.github.io/Examine/searching#fuzzy

    The method takes a value between 0 and 1 for how closely a term should be matched, so a value of 0.8F is a good starting point, for matching common search terms to variations fo that word, eg Police matching Policeman...

    ... but that is different to true synonyms, eg matching 'fast' and 'quick'

    Examine is a wrapper around Lucene.Net

    So this article: https://www.codeproject.com/Articles/32201/Lucene-Net-Custom-Synonym-Analyzer might be useful for how this might be achievable with a custom analyzer in Examine.

    For really complex search scenarios, I'll often now push the content from Umbraco into an Azure Search index, that has support for synonyms and faceting baked in!

    https://docs.microsoft.com/en-us/azure/search/search-synonyms

    (there's also a paid for package https://examinex.online/ that pushes Examine into azure search, so that might be a quick way of handling this)

    regards

    Marc

  • WombleNumber1 6 posts 87 karma points
    Oct 21, 2021 @ 15:37
    WombleNumber1
    1

    Thanks Marc - In the end the solution described on the following link that you suggested sufficed -

    https://www.codeproject.com/Articles/32201/Lucene-Net-Custom-Synonym-Analyzer

Please Sign in or register to post replies

Write your reply to:

Draft