I’m using this tag so that when I enter “appledell” (without the quotes) as a search keyword, it should give results for both Apple as well as Dell.
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.StandardFilterFactory" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="de.hybris.platform.solrfacetsearch.ysolr.synonyms.HybrisSynonymFilterFactory" ignoreCase="true" synonyms="en" coreName="${solr.core.name}"/>
<filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="0" />
<filter class="de.hybris.platform.solrfacetsearch.ysolr.stopwords.HybrisStopWordsFilterFactory" ignoreCase="true" lang="en" coreName="${solr.core.name}"/>
<filter class="solr.StopFilterFactory" words="stopwords_en.txt" ignoreCase="true" />
<filter class="solr.ASCIIFoldingFilterFactory" />
<!-- <filter class="solr.SnowballPorterFilterFactory" language="English" /> -->
<filter class="EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front" />
<filter class="EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="back" />
</analyzer>
</fieldType>
When I separately search using Apple n Dell, then it’s working fine. But it gives No results found with appledell. Any pointers will be highly appreciated.
Thanks.
That is not the usual way people use NGram. Typically you want to fin ‘appledell’ when you look for ‘apple’ or ‘dell’, not the other way around (if I understood correctly that is what you want).
In that case, you need to apply EdgeNGramFilterFactory to the query analyzer only (the usual way is to apply to the index analyzer only). But you will have other side effects, as ‘appledell’ will be decomposed in many token like ‘ap’ ‘app’ so ‘application’ will also be a match for example.