Wednesday, 5 August 2015

Umbraco Lucene Examine search in foreign languages

Today I had to implement search using Lucene/Examine on a German Umbraco site. It wasn't easy working out what to do, so here's the lowdown, for future reference.

 I installed Lucene.Net.Contrib using the Nuget Package Manager console:
PM> Install-Package Lucene.Net.Contrib -Version 2.9.4.1
Then I updated the index providers in the ExamineSettings.config file, like this example:
<add name="InternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
           supportUnpublished="true"
           supportProtected="true"
           analyzer="Lucene.Net.Analysis.De.GermanAnalyzer, Lucene.Net.Contrib.Analyzers"/>
Then, re-index the whole site.

Umbraco Lucene search without case sensitivity

I've been working on a new site build in a small team, using Umbraco 7. My task today was to implement site search, and in doing so I had a problem with case sensitivity - searching for "word" did not return results containing "Word". After some investigation it turned out we were using the WhiteSpaceAnalyzer for the indexing. Switching to the StandardAnalyzer solved my case problem.