Save This Page
Home » lucene-2.3.2-src » org.apache » lucene » queryParser » analyzing » [javadoc | source]
org.apache.lucene.queryParser.analyzing
public class: AnalyzingQueryParser [javadoc | source]
java.lang.Object
   org.apache.lucene.queryParser.QueryParser
      org.apache.lucene.queryParser.analyzing.AnalyzingQueryParser

All Implemented Interfaces:
    QueryParserConstants

Overrides Lucene's default QueryParser so that Fuzzy-, Prefix-, Range-, and WildcardQuerys are also passed through the given analyzer, but wild card characters (like *) don't get removed from the search terms.

Warning: This class should only be used with analyzers that do not use stopwords or that add tokens. Also, several stemming analyzers are inappropriate: for example, GermanAnalyzer will turn Häuser into hau, but H?user will become h?user when using this parser and thus no match would be found (i.e. using this parser will be no improvement over QueryParser in such cases).

Fields inherited from org.apache.lucene.queryParser.QueryParser:
AND_OPERATOR,  OR_OPERATOR,  lowercaseExpandedTerms,  useOldRangeQuery,  allowLeadingWildcard,  enablePositionIncrements,  analyzer,  field,  phraseSlop,  fuzzyMinSim,  fuzzyPrefixLength,  locale,  dateResolution,  fieldToDateResolution,  token_source,  token,  jj_nt,  lookingAhead
Constructor:
 public AnalyzingQueryParser(String field,
    Analyzer analyzer) 
    Constructs a query parser.
    Parameters:
    field - the default field for query terms.
    analyzer - used to find terms in the query text.
Method from org.apache.lucene.queryParser.analyzing.AnalyzingQueryParser Summary:
getFuzzyQuery,   getPrefixQuery,   getRangeQuery,   getWildcardQuery
Methods from org.apache.lucene.queryParser.QueryParser:
Clause,   Conjunction,   Modifiers,   Query,   ReInit,   ReInit,   Term,   TopLevelQuery,   addClause,   disable_tracing,   enable_tracing,   escape,   generateParseException,   getAllowLeadingWildcard,   getAnalyzer,   getBooleanQuery,   getBooleanQuery,   getDateResolution,   getDefaultOperator,   getEnablePositionIncrements,   getField,   getFieldQuery,   getFieldQuery,   getFuzzyMinSim,   getFuzzyPrefixLength,   getFuzzyQuery,   getLocale,   getLowercaseExpandedTerms,   getNextToken,   getPhraseSlop,   getPrefixQuery,   getRangeQuery,   getToken,   getUseOldRangeQuery,   getWildcardQuery,   main,   parse,   setAllowLeadingWildcard,   setDateResolution,   setDateResolution,   setDefaultOperator,   setEnablePositionIncrements,   setFuzzyMinSim,   setFuzzyPrefixLength,   setLocale,   setLowercaseExpandedTerms,   setPhraseSlop,   setUseOldRangeQuery
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.queryParser.analyzing.AnalyzingQueryParser Detail:
 protected Query getFuzzyQuery(String field,
    String termStr,
    float minSimilarity) throws ParseException 
    Called when parser parses an input term token that has the fuzzy suffix (~) appended.

    Depending on analyzer and settings, a fuzzy term may (most probably will) be lower-cased automatically. It will go through the default Analyzer.

    Overrides super class, by passing terms through analyzer.

 protected Query getPrefixQuery(String field,
    String termStr) throws ParseException 
    Called when parser parses an input term token that uses prefix notation; that is, contains a single '*' wildcard character as its last character. Since this is a special case of generic wildcard term, and such a query can be optimized easily, this usually results in a different query object.

    Depending on analyzer and settings, a prefix term may (most probably will) be lower-cased automatically. It will go through the default Analyzer.

    Overrides super class, by passing terms through analyzer.

 protected Query getRangeQuery(String field,
    String part1,
    String part2,
    boolean inclusive) throws ParseException 
    Overrides super class, by passing terms through analyzer.
 protected Query getWildcardQuery(String field,
    String termStr) throws ParseException 
    Called when parser parses an input term token that contains one or more wildcard characters (like *), but is not a prefix term token (one that has just a single * character at the end).

    Example: will be called for H?user or for H*user but not for *user.

    Depending on analyzer and settings, a wildcard term may (most probably will) be lower-cased automatically. It will go through the default Analyzer.

    Overrides super class, by passing terms through analyzer.