org.apache.solr.spelling

## Class QueryConverter

- java.lang.Object
- - org.apache.solr.spelling.QueryConverter

- All Implemented Interfaces:
    NamedListInitializedPlugin
  Direct Known Subclasses:
    SpellingQueryConverter

      public abstract class QueryConverter
      extends Object
      implements NamedListInitializedPlugin

  The QueryConverter is an abstract base class defining a method for converting input "raw" queries into a set of tokens for spell checking. It is used to "parse" the CommonParams.Q (the input query) and converts it to tokens.

  It is only invoked for the CommonParams.Q parameter, and not the "spellcheck.q" parameter. Systems that use their own query parser or those that find issue with the basic implementation should implement their own QueryConverter instead of using the provided implementation (SpellingQueryConverter) by overriding the appropriate methods on the SpellingQueryConverter and registering it in the solrconfig.xml

  Refer to SpellCheckComponent for more details

  Since:
    solr 1.3

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Analyzer` | `analyzer`
    `static int` | `PROHIBITED_TERM_FLAG` This term is marked prohibited in the query with the minus sign.
    `static int` | `REQUIRED_TERM_FLAG` This term is marked required in the query with the plus sign.
    `static int` | `TERM_IN_BOOLEAN_QUERY_FLAG` This term exists in a query that contains boolean operators (AND/OR/NOT)
    `static int` | `TERM_PRECEDES_NEW_BOOLEAN_OPERATOR_FLAG` This term is directly followed by a boolean operator (AND/OR/NOT) and this operator differs from the prior boolean operator in the query (this signifies this term is likely part of a different query clause than the next term in the query)

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryConverter()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Collection<Token>` | `convert(String original)` Returns the Collection of `Token`s for the query.
    `Analyzer` | `getAnalyzer()`
    `void` | `init(NamedList args)`
    `void` | `setAnalyzer(Analyzer analyzer)` Set the analyzer to use.

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

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

- - ### Field Detail

    - #### analyzer

          protected Analyzer analyzer

    - #### PROHIBITED_TERM_FLAG

          public static final int PROHIBITED_TERM_FLAG

      This term is marked prohibited in the query with the minus sign.

      See Also:
        Constant Field Values

    - #### REQUIRED_TERM_FLAG

          public static final int REQUIRED_TERM_FLAG

      This term is marked required in the query with the plus sign.

      See Also:
        Constant Field Values

    - #### TERM_PRECEDES_NEW_BOOLEAN_OPERATOR_FLAG

          public static final int TERM_PRECEDES_NEW_BOOLEAN_OPERATOR_FLAG

      This term is directly followed by a boolean operator (AND/OR/NOT) and this operator differs from the prior boolean operator in the query (this signifies this term is likely part of a different query clause than the next term in the query)

      See Also:
        Constant Field Values

    - #### TERM_IN_BOOLEAN_QUERY_FLAG

          public static final int TERM_IN_BOOLEAN_QUERY_FLAG

      This term exists in a query that contains boolean operators (AND/OR/NOT)

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### QueryConverter

          public QueryConverter()

  - ### Method Detail

    - #### init

          public void init(NamedList args)

      Specified by:
        `init` in interface `NamedListInitializedPlugin`

    - #### convert

          public abstract Collection<Token> convert(String original)

      Returns the Collection of `Token`s for the query. Offsets on the Token should correspond to the correct offset in the origQuery

    - #### setAnalyzer

          public void setAnalyzer(Analyzer analyzer)

      Set the analyzer to use. Must be set before any calls to convert.

    - #### getAnalyzer

          public Analyzer getAnalyzer()

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