Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

AEM 6.1 - Search synonyms

Avatar

Level 6

Hi,

Does AEM 6.1 Lucene indexes support synonyms?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 8

You know, it actually looks like it's not supported.

See here: http://www.slideshare.net/justinedelson/demystifying-oak-search slide 40 and 41, specifically states that synonyms are not supported.

View solution in original post

9 Replies

Avatar

Level 8

I believe you can utilize the tilde (~) to do this.

Avatar

Level 6

Hi @leeasling,

But where do I configure the synonyms?

Thanks

Avatar

Correct answer by
Level 8

You know, it actually looks like it's not supported.

See here: http://www.slideshare.net/justinedelson/demystifying-oak-search slide 40 and 41, specifically states that synonyms are not supported.

Avatar

Level 6

@leeasling I just saw this presentation.

Thanks for your help!

Avatar

Level 2

Synonym weren't supported initially in AEM 6.0 / Oak 1.0.x.

In AEM 6.1 (Oak 1.2.x) it should work. You can configure synonyms in similar way how stop-words can be configured.
See https://jackrabbit.apache.org/oak/docs/query/lucene.html#Create_analyzer_via_composition and just replace, "Stop" node with the following "Synonym" node structure

+ Synonym
   - synonyms = "synonyms.txt"
   + synonyms.txt (nt:file)

Should work if didn't make a typo.

Avatar

Employee

franciscoribeir wrote...

@leeasling I just saw this presentation.

Thanks for your help!

The presentation covers  OAK 1.0.5 (AEM 6.0 SP1)

Please try the suggestion from @Pacoolsky

Avatar

Level 6

@Pacoolsky and @Opkar Gill,

I used this synonym.txt for testing:

aaafoo => aaabar bbbfoo => bbbfoo bbbbar cccfoo => cccbar cccbaz fooaaa,baraaa,bazaaa # Some synonym groups specific to this example GB,gib,gigabyte,gigabytes MB,mib,megabyte,megabytes Television, Televisions, TV, TVs clash, battle, fight #notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming #after us won't split it into two words. # Synonym mappings can be used for spelling correction too pixima => pixma teh => the tablet, tableau

I know that they are being loaded because if I put a wrong line it break.

But when I try to search for one of the synonyms it doesn't retrieve.

For example, I update one asset to have the "tablet" text and other to have "tableau".

If I search for tablet it retrieves only the tablet one not both tablet and tableau. The same happens for tableau.

is there any other config I should check?

Thanks

Avatar

Level 6

Hey,

It worked!!

The problem was that I had two index and both were evaluated. Once I deleted one of them it worked.

Thanks

Avatar

Level 6

One Thing I noticed after adding this analyzer config, is that some searches I was able to perform now are not working anymore.

For example, I was able to search by tags for example, if I have an Asset tagged with nature/geological_feature

I was able to return it searching for nature or geological, but now it is not working.

Do you know what are the default list of Filters used by lucene? So I can use them plus synonym filter?

Thanks