I have found Sitecore NGram. how to set up auto complete with NGram for sitecore 7. I am trying to repeat it but I am confused about some parts:
IComputedIndexField implementation that is never calls. I have setup it in Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config like here:
<fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap,
Sitecore.ContentSearch.SolrProvider">
<typeMatches>
<typeMatch typeName="autoComplete" type="System.String" fieldNameFormat="{0}_ac" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration,
Sitecore.ContentSearch.SolrProvider" />
</typeMatches>
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="titlesearch" returnType="autoComplete">MyLib.AutoCompleteTitle, MyLib</field>
</fieldNames>
</fieldMap>
only one different with example is read property value:
return item.Fields["Title"].Value;
2 Added configuration to schema.xml - fieldType name="auto_complete" Code:
<fieldType name="auto_complete" 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" />
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="30" />
</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>
3 Restarted Solr and Rebuild sitecore index
4 I am confused that property name I should use for search (looks like setting for IComputedIndexField)
using (var context = ContentSearchManager.GetIndex(_searchIndexName).CreateSearchContext())
{
var dataQuery = context.GetQueryable<SearchResultItem>().Where(i =>i["titlesearch_ac"] == searchString).Take(20);
return dataQuery;
}
it is no any error, but I can't get auto-complete results....