SolrQueryParser (Solr 3.6.2 API)
Keywords: org.apache.solr.search.SolrQueryParser class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.search
Class SolrQueryParser

    java.lang.Object
      org.apache.lucene.queryParser.QueryParser
          org.apache.solr.search.SolrQueryParser

All Implemented Interfaces:
  QueryParserConstants

Direct Known Subclasses:
  SolrPluginUtils.DisjunctionMaxQueryParser

    public class SolrQueryParser

extends QueryParser

A variation on the Lucene QueryParser which knows about the field types and query time analyzers configured in Solr's schema.xml.

This class also deviates from the Lucene QueryParser by using ConstantScore versions of RangeQuery and PrefixQuery to prevent TooManyClauses exceptions.

If the magic field name "`_val_`" is used in a term or phrase query, the value is parsed as a function.

See Also:
  `QueryParsing.parseFunction(java.lang.String, org.apache.solr.schema.IndexSchema)`

Nested Class Summary
`static class` | `SolrQueryParser.MagicFieldName` Identifies the list of all known "magic fields" that trigger special parsing behavior

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

Field Summary
`protected String` | `defaultField`
`protected QParser` | `parser`
`protected IndexSchema` | `schema`

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
`SolrQueryParser(IndexSchema schema, String defaultField)` Constructs a SolrQueryParser using the schema to understand the formats and datatypes of each field.
`SolrQueryParser(QParser parser, String defaultField)`
`SolrQueryParser(QParser parser, String defaultField, Analyzer analyzer)`

Method Summary
`protected String` | `analyzeIfMultitermTermText(String field, String part, FieldType fieldType)`
`protected Query` | `getFieldQuery(String field, String queryText, boolean quoted)`
`protected Query` | `getPrefixQuery(String field, String termStr)`
`protected Query` | `getRangeQuery(String field, String part1, String part2, boolean inclusive)`
`protected ReversedWildcardFilterFactory` | `getReversedWildcardFilterFactory(FieldType fieldType)`
`protected Query` | `getWildcardQuery(String field, String termStr)`

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, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getLowercaseExpandedTerms, getMultiTermRewriteMethod, getNextToken, getPhraseSlop, getRangeCollator, getToken, main, Modifiers, newBooleanClause, newBooleanQuery, newFuzzyQuery, newMatchAllDocsQuery, newMultiPhraseQuery, newPhraseQuery, newPrefixQuery, newRangeQuery, newTermQuery, newWildcardQuery, parse, Query, ReInit, ReInit, setAllowLeadingWildcard, setAutoGeneratePhraseQueries, setDateResolution, setDateResolution, setDefaultOperator, setEnablePositionIncrements, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setMultiTermRewriteMethod, setPhraseSlop, setRangeCollator, Term, TopLevelQuery`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### schema

    protected final IndexSchema schema

### parser

    protected final QParser parser

### defaultField

    protected final String defaultField

Constructor Detail

### SolrQueryParser

    public SolrQueryParser(IndexSchema schema,
                           String defaultField)

  Constructs a SolrQueryParser using the schema to understand the formats and datatypes of each field. Only the defaultSearchField will be used from the IndexSchema (unless overridden), <solrQueryParser> will not be used.

  Parameters:
    `schema` - Used for default search field name if defaultField is null and field information is used for analysis
    `defaultField` - default field used for unspecified search terms. if null, the schema default field is used
  See Also:
    `IndexSchema.getDefaultSearchFieldName()`

### SolrQueryParser

    public SolrQueryParser(QParser parser,
                           String defaultField)

### SolrQueryParser

    public SolrQueryParser(QParser parser,
                           String defaultField,
                           Analyzer analyzer)

Method Detail

### getReversedWildcardFilterFactory

    protected ReversedWildcardFilterFactory getReversedWildcardFilterFactory(FieldType fieldType)

### analyzeIfMultitermTermText

    protected String analyzeIfMultitermTermText(String field,
                                                String part,
                                                FieldType fieldType)

### getFieldQuery

    protected Query getFieldQuery(String field,
                                  String queryText,
                                  boolean quoted)
                           throws ParseException

  Overrides:
    `getFieldQuery` in class `QueryParser`
  Throws:
    `ParseException`

### getRangeQuery

    protected Query getRangeQuery(String field,
                                  String part1,
                                  String part2,
                                  boolean inclusive)
                           throws ParseException

  Overrides:
    `getRangeQuery` in class `QueryParser`
  Throws:
    `ParseException`

### getPrefixQuery

    protected Query getPrefixQuery(String field,
                                   String termStr)
                            throws ParseException

  Overrides:
    `getPrefixQuery` in class `QueryParser`
  Throws:
    `ParseException`

### getWildcardQuery

    protected Query getWildcardQuery(String field,
                                     String termStr)
                              throws ParseException

  Overrides:
    `getWildcardQuery` in class `QueryParser`
  Throws:
    `ParseException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD