Issue
Autosuggest queries sent to the /suggest endpoint are limited to approximately 31 characters, even when longer input strings are provided. For example, the following query works:
https://<fusion-host>/api/apps/<app-name>/query/<collection-name>?q=New York Life Investments SIMPBut adding more characters to the query string fails to return results:
https://<fusion-host>/api/apps/<app-name>/query/<collection-name>?q=New York Life Investments SIMPLEDiagnosis
This issue is not controlled by the solrconfig.xml file or suggest handler settings. Instead, it is determined by the schema definition of the field type used in the suggest dictionary.
Specifically, the EdgeNGramFilterFactory used in the field type (commonly named text_suggest_edge) restricts the maximum number of characters analyzed.
To confirm, check your managed-schema.xml file for the suggester's fieldType definition. For example:
<fieldType name="text_suggest_edge" class="solr.TextField" multiValued="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="30"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>Environment
Fusion 5.9.x and later
Fusion deployments using suggest components backed by EdgeNGram-based field types
Cause
The maxGramSize attribute in the EdgeNGramFilterFactory limits how many characters are indexed for autocomplete purposes. A lower setting, such as 30, prevents matches on longer strings.
Resolution
Update the schema to increase the maxGramSize parameter.
Update the schema
Edit the
managed-schema.xmlfor the collection that backs the suggester component.Locate the
text_suggest_edgeor equivalent fieldType used in the suggester.Modify the
EdgeNGramFilterFactoryfilter to increasemaxGramSize. Example:
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="150"/>Reload the collection
After updating the schema, reload the collection using:
curl -u <username>:<password> "https://<fusion-host>/api/apollo/collections/<collection-name>/reload"Rebuild the suggester index
Use the Fusion UI or API to trigger a reindex of the suggester pipeline to reflect the updated schema changes.
Note: Failure to reload the collection and rebuild the suggester will result in the changes not taking effect.