Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "AnalyzersTokenizersTokenFilters" page has been changed by RobertMuir. http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters?action=diff&rev1=76&rev2=77 -------------------------------------------------- <filter class="solr.PositionFilterFactory" /> }}} + PositionFilter can be used with a query Analyzer to prevent expensive Phrase and MultiPhraseQueries. When QueryParser parses a query, it first divides text on whitespace, and then Analyzes each whitespace token. Some TokenStreams such as StandardTokenizer or WordDelimiterFilter may divide one of these whitespace-separate tokens into multiple tokens. + + The QueryParser will turn "multiple tokens" into a Phrase or MultiPhraseQuery, but "multiple tokens at the same position with only a position count of 1" is treated as a special case. You can use PositionFilter at the end of your QueryAnalyzer to force any subsequent tokens after the first one to have a position increment of zero, to trigger this case. + + For example, by default a query of "Wi-Fi" with StandardTokenizer will create a PhraseQuery: + {{{ + field:"Wi Fi" + }}} + If you instead wrap the StandardTokenizer with PositionFilter, the "Fi" will have a position increment of zero, creating a BooleanQuery: + {{{ + field:Wi field:Fi + }}} + - An example is when exact matching hits are wanted for _any_ shingle within the query. (This was done at http://sesam.no to replace three proprietary 'FAST Query-Matching servers' with two open sourced Solr indexes, background reading in [[http://sesat.no/howto-solr-query-evaluation.html|sesat]] and on the [[http://comments.gmane.org/gmane.comp.jakarta.lucene.user/34746|mailing list]]). + Another example is when exact matching hits are wanted for _any_ shingle within the query. (This was done at http://sesam.no to replace three proprietary 'FAST Query-Matching servers' with two open sourced Solr indexes, background reading in [[http://sesat.no/howto-solr-query-evaluation.html|sesat]] and on the [[http://comments.gmane.org/gmane.comp.jakarta.lucene.user/34746|mailing list]]). It was needed that in the query all words and shingles to be placed at the same position, so that all shingles to be treated as synonyms of each other. With only the ShingleFilter the shingles generated are synonyms only to the first term in each shingle group.
