Hi, I have a fieldtype as below configured to index the autocomplete phrase. Everything worked fine except for the fact that some of the phrases were too long so we had to limit the maximum number of words in a phrase hence I added a regular expression which will remove all other words except the first 3 words.
* <filter class="solr.PatternReplaceFilterFactory" pattern="^((?:\S+\s+){2}\S+).*" replacement="$1"/> * This regular expression works fine when I use analyze the field using the SOLR dashboard but doesnt actually limit the words during indexing. I am not sure if I am doing anything wrong.. Can someone help me figure out the issue? *Field Type:* <fieldType class="solr.TextField" name="textSpell" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.KeywordTokenizerFactory"/> * <filter class="solr.PatternReplaceFilterFactory" pattern="^((?:\S+\s+){2}\S+).*" replacement="$1"/> * <filter class="solr.StopFilterFactory" enablePositionIncrements="true" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.PatternReplaceFilterFactory" pattern="^(\p{Punct}*)(.*?)(\p{Punct}*)$" replacement="$2"/> <filter class="solr.StandardFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/> *Field:* <field indexed="true" multiValued="true" name="autocomplete_phrase" stored="true" type="textSpell"/> *Copy Field:* <copyField dest="autocomplete_phrase" source="displayName"/> <copyField dest="autocomplete_phrase" source="manufacturer"/> -- View this message in context: http://lucene.472066.n3.nabble.com/Limit-the-number-of-words-in-Auto-complete-using-RE-not-working-tp4113790.html Sent from the Solr - User mailing list archive at Nabble.com.