org.compass.core.lucene.engine.queryparser
Class CompassQueryParser

java.lang.Object
  extended by org.apache.lucene.queryParser.QueryParser
      extended by org.compass.core.lucene.engine.queryparser.CompassQueryParser
All Implemented Interfaces:
QueryParserConstants

public class CompassQueryParser
extends QueryParser

Extends Lucene QueryParser and overrides getRangeQuery(String,String,String,boolean) since lucene performs data parsing which is a performance killer. Anyhow, handling dates in Compass is different and simpler than Lucene.

Author:
kimchy

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.queryParser.QueryParser
QueryParser.Operator
 
Field Summary
 
Fields inherited from class org.apache.lucene.queryParser.QueryParser
AND_OPERATOR, jj_nt, lookingAhead, OR_OPERATOR, token, token_source
 
Fields inherited from interface org.apache.lucene.queryParser.QueryParserConstants
_ESCAPED_CHAR, _NUM_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, Boost, CARAT, COLON, DEFAULT, EOF, FUZZY_SLOP, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, RangeEx, RANGEEX_END, RANGEEX_GOOP, RANGEEX_QUOTED, RANGEEX_START, RANGEEX_TO, RangeIn, RANGEIN_END, RANGEIN_GOOP, RANGEIN_QUOTED, RANGEIN_START, RANGEIN_TO, RPAREN, STAR, TERM, tokenImage, WILDTERM
 
Constructor Summary
CompassQueryParser(String f, Analyzer a, CompassMapping mapping)
           
 
Method Summary
protected  Query getFieldQuery(String field, String queryText)
           
protected  Query getFuzzyQuery(String field, String termStr, float minSimilarity)
           
protected  Query getPrefixQuery(String field, String termStr)
           
protected  Query getRangeQuery(String field, String part1, String part2, boolean inclusive)
          Override it so we won't use the date format to try and parse dates
protected  Query getWildcardQuery(String field, String termStr)
           
 void setAllowConstantScorePrefixQuery(boolean allowConstantScorePrefixQuery)
           
 
Methods inherited from class org.apache.lucene.queryParser.QueryParser
addClause, Clause, Conjunction, disable_tracing, enable_tracing, escape, generateParseException, getAllowLeadingWildcard, getAnalyzer, getBooleanQuery, getBooleanQuery, getDateResolution, getDefaultOperator, getField, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getLocale, getLowercaseExpandedTerms, getNextToken, getPhraseSlop, getToken, getUseOldRangeQuery, main, Modifiers, parse, Query, ReInit, ReInit, setAllowLeadingWildcard, setDateResolution, setDateResolution, setDefaultOperator, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setPhraseSlop, setUseOldRangeQuery, Term, TopLevelQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompassQueryParser

public CompassQueryParser(String f,
                          Analyzer a,
                          CompassMapping mapping)
Method Detail

setAllowConstantScorePrefixQuery

public void setAllowConstantScorePrefixQuery(boolean allowConstantScorePrefixQuery)

getWildcardQuery

protected Query getWildcardQuery(String field,
                                 String termStr)
                          throws ParseException
Overrides:
getWildcardQuery in class QueryParser
Throws:
ParseException

getFuzzyQuery

protected Query getFuzzyQuery(String field,
                              String termStr,
                              float minSimilarity)
                       throws ParseException
Overrides:
getFuzzyQuery in class QueryParser
Throws:
ParseException

getFieldQuery

protected Query getFieldQuery(String field,
                              String queryText)
                       throws ParseException
Overrides:
getFieldQuery in class QueryParser
Throws:
ParseException

getRangeQuery

protected Query getRangeQuery(String field,
                              String part1,
                              String part2,
                              boolean inclusive)
                       throws ParseException
Override it so we won't use the date format to try and parse dates

Overrides:
getRangeQuery in class QueryParser
Throws:
ParseException

getPrefixQuery

protected Query getPrefixQuery(String field,
                               String termStr)
                        throws ParseException
Overrides:
getPrefixQuery in class QueryParser
Throws:
ParseException


Copyright (c) 2004-2006 The Compass Project.