org.apache.lucene.queryparser.ext

## Class ParserExtension

- java.lang.Object
- - org.apache.lucene.queryparser.ext.ParserExtension

-     public abstract class ParserExtension
      extends Object

  This class represents an extension base class to the Lucene standard `QueryParser`. The `QueryParser` is generated by the JavaCC parser generator. Changing or adding functionality or syntax in the standard query parser requires changes to the JavaCC source file. To enable extending the standard query parser without changing the JavaCC sources and re-generate the parser the `ParserExtension` can be customized and plugged into an instance of `ExtendableQueryParser`, a direct subclass of `QueryParser`.
  See Also:
    `Extensions`, `ExtendableQueryParser`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParserExtension()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Query` | `parse(ExtensionQuery query)` Processes the given `ExtensionQuery` and returns a corresponding `Query` instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ParserExtension

          public ParserExtension()

  - ### Method Detail

    - #### parse

          public abstract Query parse(ExtensionQuery query)
                               throws ParseException

      Processes the given `ExtensionQuery` and returns a corresponding `Query` instance. Subclasses must either return a `Query` instance or raise a `ParseException`. This method must not return `null`.
      Parameters:
        `query` - the extension query
      Returns:
        a new query instance
      Throws:
        `ParseException` - if the query can not be parsed.

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.