lux.query.parser
Class LuxQueryParser

java.lang.Object
  extended by org.apache.lucene.queryparser.classic.QueryParserBase
      extended by org.apache.lucene.queryparser.classic.QueryParser
          extended by org.apache.lucene.queryparser.ext.ExtendableQueryParser
              extended by lux.query.parser.LuxQueryParser
All Implemented Interfaces:
org.apache.lucene.queryparser.classic.QueryParserConstants, org.apache.lucene.queryparser.flexible.standard.CommonQueryParserConfiguration

public class LuxQueryParser
extends org.apache.lucene.queryparser.ext.ExtendableQueryParser

A Lucene query parser extension that supports query terms of the form:

[node]<[nodeName]:[term]

In which nodeName is either empty, an unqualified element name, a prefixed element name (ie a QName), or a QName prefixed with "@", indicating an attribute. nodeName is optional: if it is not present, a full text query of the entire document is indicated. The "node" prefix is also optional. Concrete examples:

  node<:"Alas, poor Yorick"
  node
 
 AND
 
 Boolean queries containing a marker term: lux_within:{slop} or lux_near:{slop} will be
 replaced by a SpanNearQuery, if the term is required, or a SpanOrQuery, otherwise.  Note
 that all BooleanQueries nested inside a marked query must also themselves be marked (as a Span).


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.queryparser.classic.QueryParser
org.apache.lucene.queryparser.classic.QueryParser.Operator
 
Nested classes/interfaces inherited from class org.apache.lucene.queryparser.classic.QueryParserBase
org.apache.lucene.queryparser.classic.QueryParserBase.MethodRemovedUseAnother
 
Field Summary
 
Fields inherited from class org.apache.lucene.queryparser.classic.QueryParser
jj_nt, token, token_source
 
Fields inherited from class org.apache.lucene.queryparser.classic.QueryParserBase
AND_OPERATOR, OR_OPERATOR
 
Fields inherited from interface org.apache.lucene.queryparser.classic.QueryParserConstants
_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, BAREOPER, Boost, CARAT, COLON, DEFAULT, EOF, FUZZY_SLOP, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, Range, RANGE_GOOP, RANGE_QUOTED, RANGE_TO, RANGEEX_END, RANGEEX_START, RANGEIN_END, RANGEIN_START, REGEXPTERM, RPAREN, STAR, TERM, tokenImage, WILDTERM
 
Constructor Summary
LuxQueryParser(org.apache.lucene.util.Version matchVersion, String f, org.apache.lucene.analysis.Analyzer a, org.apache.lucene.queryparser.ext.Extensions ext, NodeQueryBuilder queryBuilder)
           
 
Method Summary
 void bindNamespacePrefix(String prefix, String namespaceURI)
          declares a namespace binding.
 void clearNamespaces()
           
static String escapeQParser(String s)
           
static LuxQueryParser makeLuxQueryParser(IndexConfiguration config)
           
 org.apache.lucene.search.Query parse(String queryString)
           
 
Methods inherited from class org.apache.lucene.queryparser.ext.ExtendableQueryParser
getExtensionFieldDelimiter, getFieldQuery
 
Methods inherited from class org.apache.lucene.queryparser.classic.QueryParser
Clause, Conjunction, disable_tracing, enable_tracing, generateParseException, getNextToken, getToken, Modifiers, Query, ReInit, ReInit, Term, TopLevelQuery
 
Methods inherited from class org.apache.lucene.queryparser.classic.QueryParserBase
addClause, analyzeMultitermTerm, escape, getAllowLeadingWildcard, getAnalyzer, getAnalyzeRangeTerms, getAutoGeneratePhraseQueries, getBooleanQuery, getBooleanQuery, getDateResolution, getDefaultOperator, getEnablePositionIncrements, getField, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getLowercaseExpandedTerms, getMultiTermRewriteMethod, getPhraseSlop, getPrefixQuery, getRangeQuery, getRegexpQuery, getTimeZone, getWildcardQuery, init, newBooleanClause, newBooleanQuery, newFieldQuery, newFuzzyQuery, newMatchAllDocsQuery, newMultiPhraseQuery, newPhraseQuery, newPrefixQuery, newRangeQuery, newRegexpQuery, newTermQuery, newWildcardQuery, setAllowLeadingWildcard, setAnalyzeRangeTerms, setAutoGeneratePhraseQueries, setDateResolution, setDateResolution, setDefaultOperator, setEnablePositionIncrements, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setMultiTermRewriteMethod, setPhraseSlop, setTimeZone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuxQueryParser

public LuxQueryParser(org.apache.lucene.util.Version matchVersion,
                      String f,
                      org.apache.lucene.analysis.Analyzer a,
                      org.apache.lucene.queryparser.ext.Extensions ext,
                      NodeQueryBuilder queryBuilder)
Method Detail

makeLuxQueryParser

public static LuxQueryParser makeLuxQueryParser(IndexConfiguration config)

bindNamespacePrefix

public void bindNamespacePrefix(String prefix,
                                String namespaceURI)
declares a namespace binding.

Parameters:
prefix - The namespace prefix to bind. No attempt is made to ensure that the prefix is syntactically valid. It is not possible to declare a default namespace using this API: the default namespace is always no namespace in this query syntax. If this method is called with a null or empty prefix, the effect is undefined.
namespaceURI - The namespace "URI" to bind. If empty or null, any existing binding for the prefix is removed.

clearNamespaces

public void clearNamespaces()

parse

public org.apache.lucene.search.Query parse(String queryString)
                                     throws org.apache.lucene.queryparser.classic.ParseException
Overrides:
parse in class org.apache.lucene.queryparser.classic.QueryParserBase
Throws:
org.apache.lucene.queryparser.classic.ParseException

escapeQParser

public static final String escapeQParser(String s)


Copyright © 2013. All Rights Reserved.