Class JackrabbitQueryParser

  • All Implemented Interfaces:
    org.apache.lucene.queryParser.QueryParserConstants

    public class JackrabbitQueryParser
    extends org.apache.lucene.queryParser.QueryParser
    JackrabbitQueryParser extends the standard lucene query parser and adds JCR specific customizations.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.lucene.queryParser.QueryParser

        org.apache.lucene.queryParser.QueryParser.Operator
    • Field Summary

      • Fields inherited from class org.apache.lucene.queryParser.QueryParser

        AND_OPERATOR, jj_nt, OR_OPERATOR, token, token_source
      • Fields inherited from interface org.apache.lucene.queryParser.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, 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

      Constructors 
      Constructor Description
      JackrabbitQueryParser​(String fieldName, Analyzer analyzer, SynonymProvider synonymProvider, org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
      Creates a new query parser instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Query getFieldQuery​(String field, String queryText)
      protected Query getFieldQuery​(String field, String queryText, boolean quoted)
      protected Query getPrefixQuery​(String field, String termStr)
      protected Query getSynonymQuery​(String field, String termStr)
      Factory method for generating a synonym query.
      protected Query getWildcardQuery​(String field, String termStr)
      Query parse​(String textsearch)
      • Methods inherited from class org.apache.lucene.queryParser.QueryParser

        addClause, Clause, Conjunction, disable_tracing, enable_tracing, escape, generateParseException, getAllowLeadingWildcard, getAnalyzer, getAutoGeneratePhraseQueries, getBooleanQuery, getBooleanQuery, getDateResolution, getDefaultOperator, getEnablePositionIncrements, getField, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getLowercaseExpandedTerms, getMultiTermRewriteMethod, getNextToken, getPhraseSlop, getRangeCollator, getRangeQuery, getToken, main, Modifiers, newBooleanClause, newBooleanQuery, newFuzzyQuery, newMatchAllDocsQuery, newMultiPhraseQuery, newPhraseQuery, newPrefixQuery, newRangeQuery, newTermQuery, newWildcardQuery, Query, ReInit, ReInit, setAllowLeadingWildcard, setAutoGeneratePhraseQueries, setDateResolution, setDateResolution, setDefaultOperator, setEnablePositionIncrements, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setMultiTermRewriteMethod, setPhraseSlop, setRangeCollator, Term, TopLevelQuery
    • Constructor Detail

      • JackrabbitQueryParser

        public JackrabbitQueryParser​(String fieldName,
                                     Analyzer analyzer,
                                     SynonymProvider synonymProvider,
                                     org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
        Creates a new query parser instance.
        Parameters:
        fieldName - the field name.
        analyzer - the analyzer.
        synonymProvider - the synonym provider or null if none is available.
    • Method Detail

      • parse

        public Query parse​(String textsearch)
                    throws org.apache.lucene.queryParser.ParseException
        Overrides:
        parse in class org.apache.lucene.queryParser.QueryParser
        Throws:
        org.apache.lucene.queryParser.ParseException
      • getSynonymQuery

        protected Query getSynonymQuery​(String field,
                                        String termStr)
                                 throws org.apache.lucene.queryParser.ParseException
        Factory method for generating a synonym query. Called when parser parses an input term token that has the synonym prefix (~term) prepended.
        Parameters:
        field - Name of the field query will use.
        termStr - Term token to use for building term for the query
        Returns:
        Resulting Query built for the term
        Throws:
        org.apache.lucene.queryParser.ParseException - throw in overridden method to disallow
      • getFieldQuery

        protected Query getFieldQuery​(String field,
                                      String queryText)
                               throws org.apache.lucene.queryParser.ParseException
        Overrides:
        getFieldQuery in class org.apache.lucene.queryParser.QueryParser
        Throws:
        org.apache.lucene.queryParser.ParseException
      • getFieldQuery

        protected Query getFieldQuery​(String field,
                                      String queryText,
                                      boolean quoted)
                               throws org.apache.lucene.queryParser.ParseException
        Overrides:
        getFieldQuery in class org.apache.lucene.queryParser.QueryParser
        Throws:
        org.apache.lucene.queryParser.ParseException
      • getPrefixQuery

        protected Query getPrefixQuery​(String field,
                                       String termStr)
                                throws org.apache.lucene.queryParser.ParseException
        Overrides:
        getPrefixQuery in class org.apache.lucene.queryParser.QueryParser
        Throws:
        org.apache.lucene.queryParser.ParseException
      • getWildcardQuery

        protected Query getWildcardQuery​(String field,
                                         String termStr)
                                  throws org.apache.lucene.queryParser.ParseException
        Overrides:
        getWildcardQuery in class org.apache.lucene.queryParser.QueryParser
        Throws:
        org.apache.lucene.queryParser.ParseException