Class ComplexPhraseQueryParser

  • All Implemented Interfaces:
    QueryParserConstants, CommonQueryParserConfiguration

    public class ComplexPhraseQueryParser
    extends QueryParser
    QueryParser which permits complex phrase query syntax eg "(john jon jonathan~) peters*".

    Performs potentially multiple passes over Query text to parse any nested logic in PhraseQueries. - First pass takes any PhraseQuery content between quotes and stores for subsequent pass. All other query content is parsed as normal - Second pass parses any stored PhraseQuery content, checking all embedded clauses are referring to the same field and therefore can be rewritten as Span queries. All PhraseQuery clauses are expressed as ComplexPhraseQuery objects

    This could arguably be done in one pass using a new QueryParser but here I am working within the constraints of the existing parser as a base class. This currently simply feeds all phrase content through an analyzer to select phrase terms - any "special" syntax such as * ~ * etc are not given special status

    • Constructor Detail

      • ComplexPhraseQueryParser

        public ComplexPhraseQueryParser​(Version matchVersion,
                                        java.lang.String f,
                                        Analyzer a)