org.apache.solr.analysis
Class CommonGramsQueryFilter
java.lang.Object
org.apache.lucene.util.AttributeSource
org.apache.lucene.analysis.TokenStream
org.apache.lucene.analysis.TokenFilter
org.apache.solr.analysis.BufferedTokenStream
org.apache.solr.analysis.CommonGramsQueryFilter
public class CommonGramsQueryFilter
- extends BufferedTokenStream
Wrap a CommonGramsFilter optimizing phrase queries by only returning single
words when they are not a member of a bigram.
Example:
- query input to CommonGramsFilter: "the rain in spain falls mainly"
- output of CommomGramsFilter/input to CommonGramsQueryFilter:
|"the, "the-rain"|"rain" "rain-in"|"in, "in-spain"|"spain"|"falls"|"mainly"
- output of CommonGramsQueryFilter:"the-rain", "rain-in" ,"in-spain",
"falls", "mainly"
Methods inherited from class org.apache.lucene.util.AttributeSource |
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, restoreState, toString |
CommonGramsQueryFilter
public CommonGramsQueryFilter(CommonGramsFilter input)
- Constructor
- Parameters:
input
- must be a CommonGramsFilter!
reset
public void reset()
throws IOException
- Overrides:
reset
in class BufferedTokenStream
- Throws:
IOException
process
public Token process(Token token)
throws IOException
- Output bigrams whenever possible to optimize queries. Only output unigrams
when they are not a member of a bigram. Example:
Copyright © 2011 Apache Software Foundation. All Rights Reserved.