Class SimpleQParserPlugin

  • All Implemented Interfaces:
    AutoCloseable, SolrInfoBean, SolrMetricProducer, NamedListInitializedPlugin

    public class SimpleQParserPlugin
    extends QParserPlugin
    Create a query from the input value that will be parsed by Lucene's SimpleQueryParser. See SimpleQueryParser for details on the exact syntax allowed to be used for queries.
    The following options may be applied for parsing the query.
    • q.operators - Used to enable specific operations for parsing. The operations that can be enabled are and, not, or, prefix, phrase, precedence, escape, and whitespace. By default all operations are enabled. All operations can be disabled by passing in an empty string to this parameter.
    • q.op - Used to specify the operator to be used if whitespace is a delimiter. Either 'AND' or 'OR' can be specified for this parameter. Any other string will cause an exception to be thrown. If this parameter is not specified 'OR' will be used by default.
    • qf - The list of query fields and boosts to use when building the simple query. The format is the following: fieldA^1.0 fieldB^2.2. A field can also be specified without a boost by simply listing the field as fieldA fieldB. Any field without a boost will default to use a boost of 1.0.
    • df - An override for the default field specified in the schema or a default field if one is not specified in the schema. If qf is not specified the default field will be used as the field to run the query against.
    • Field Detail

      • NAME

        public static final String NAME
        The name that can be used to specify this plugin should be used to parse the query.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SimpleQParserPlugin

        public SimpleQParserPlugin()
    • Method Detail

      • createParser

        public QParser createParser​(String qstr,
                                    org.apache.solr.common.params.SolrParams localParams,
                                    org.apache.solr.common.params.SolrParams params,
                                    SolrQueryRequest req)
        Returns a QParser that will create a query by using Lucene's SimpleQueryParser.
        Specified by:
        createParser in class QParserPlugin