I have implemented a global search on our website which gets the data result from _content field in solr indexes.
Single word search works perfectly fine but I am currently facing an issue if I have two or more words but the second word is partial. example
If I search "thrill" - search works fine.
If I search "thri" - search works fine and gives me the result of content which contains thril.
If I search "thrill rides" - search works fine
but if I search "thrill ri" or "thrill rid"- it does not return any result where I am expecting the result pages which contains "thrill rides"
It is the second partial string which does not work
I tried searching the same query inside the Sitecore content manager and it gives me the same result as on my website
So I am thinking that it is not something related in the code (below) but in the configuration.
var startItem = sitecoreContext.GetHomeItem<Item>();
using (var searchContext = ContentSearchManager.GetIndex(new SitecoreIndexableItem(startItem)).CreateSearchContext())
{
var filterPredicate = PredicateBuilder.True<SearchResultItem>();
filterPredicate = filterPredicate.And(x => x.Content.Contains(queryItem)).Or(x => x.Name.Contains(queryItem));
var query = searchContext.GetQueryable<SearchResultItem>().Filter(filterPredicate);
}
may be I need to add some configuration in
<analyzer type="index"> in schema.xml
Currently it has default settings
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
Can anyone please help me. Thanks