MultiFieldQueryParserWrapper (Lucene 3.6.2 API)
Keywords: org.apache.lucene.queryParser.standard.MultiFieldQueryParserWrapper 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.lucene.queryParser.standard
Class MultiFieldQueryParserWrapper

    java.lang.Object
      org.apache.lucene.queryParser.standard.QueryParserWrapper
          org.apache.lucene.queryParser.standard.MultiFieldQueryParserWrapper

Deprecated. this class will be removed soon, it's a temporary class to be used along the transition from the old query parser to the new one

    @Deprecated
    public class MultiFieldQueryParserWrapper

extends QueryParserWrapper

This class behaves as the as the lucene 2.4 MultiFieldQueryParser class, but uses the new query parser interface instead of the old one.
This class should be used when the new query parser features are needed and also keep at the same time the old query parser interface.

Nested Class Summary

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

Field Summary

Fields inherited from class org.apache.lucene.queryParser.standard.QueryParserWrapper
`AND_OPERATOR, OR_OPERATOR`

Constructor Summary
`MultiFieldQueryParserWrapper(String[] fields, Analyzer analyzer)` Deprecated. Creates a MultiFieldQueryParser.
`MultiFieldQueryParserWrapper(String[] fields, Analyzer analyzer, Map<String,Float> boosts)` Deprecated. Creates a MultiFieldQueryParser.

Method Summary
`static Query` | `parse(String[] queries, String[] fields, Analyzer analyzer)` Deprecated. Parses a query which searches on the fields specified.
`static Query` | `parse(String[] queries, String[] fields, BooleanClause.Occur[] flags, Analyzer analyzer)` Deprecated. Parses a query, searching on the fields specified.
`static Query` | `parse(String query, String[] fields, BooleanClause.Occur[] flags, Analyzer analyzer)` Deprecated. Parses a query, searching on the fields specified.

Methods inherited from class org.apache.lucene.queryParser.standard.QueryParserWrapper
`escape, generateParseException, getAllowLeadingWildcard, getAnalyzer, getBooleanQuery, getDateResolution, getDefaultOperator, getEnablePositionIncrements, getField, getFieldQuery, getFieldQuery, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getLowercaseExpandedTerms, getMultiTermRewriteMethod, getPhraseSlop, getPrefixQuery, getQueryConfigHandler, getQueryProcessor, getRangeCollator, getRangeQuery, getUseOldRangeQuery, getWildcardQuery, parse, setAllowLeadingWildcard, setDateResolution, setDateResolution, setDefaultOperator, setEnablePositionIncrements, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setMultiTermRewriteMethod, setPhraseSlop, setQueryBuilder, setQueryConfig, setQueryProcessor, setRangeCollator, setUseOldRangeQuery`

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

Constructor Detail

### MultiFieldQueryParserWrapper

    public MultiFieldQueryParserWrapper(String[] fields,
                                        Analyzer analyzer,
                                        Map<String,Float> boosts)

  Deprecated.
  Creates a MultiFieldQueryParser. Allows passing of a map with term to Boost, and the boost to apply to each term.

  It will, when parse(String query) is called, construct a query like this (assuming the query consists of two terms and you specify the two fields `title` and `body`):

  `(title:term1 body:term1) (title:term2 body:term2)`

  When setDefaultOperator(AND_OPERATOR) is set, the result will be:

  `+(title:term1 body:term1) +(title:term2 body:term2)`

  When you pass a boost (title=>5 body=>10) you can get

  `+(title:term1^5.0 body:term1^10.0) +(title:term2^5.0 body:term2^10.0)`

  In other words, all the query's terms must appear, but it doesn't matter in what fields they appear.

### MultiFieldQueryParserWrapper

    public MultiFieldQueryParserWrapper(String[] fields,
                                        Analyzer analyzer)

  Deprecated.
  Creates a MultiFieldQueryParser.

  It will, when parse(String query) is called, construct a query like this (assuming the query consists of two terms and you specify the two fields `title` and `body`):

  `(title:term1 body:term1) (title:term2 body:term2)`

  When setDefaultOperator(AND_OPERATOR) is set, the result will be:

  `+(title:term1 body:term1) +(title:term2 body:term2)`

  In other words, all the query's terms must appear, but it doesn't matter in what fields they appear.

Method Detail

### parse

    public static Query parse(String[] queries,
                              String[] fields,
                              Analyzer analyzer)
                       throws ParseException

  Deprecated.
  Parses a query which searches on the fields specified.

  If x fields are specified, this effectively constructs:

       <code>
       (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)
       </code>

  Parameters:
    `queries` - Queries strings to parse
    `fields` - Fields to search on
    `analyzer` - Analyzer to use
  Throws:
    `ParseException` - if query parsing fails
    `IllegalArgumentException` - if the length of the queries array differs from the length of the fields array

### parse

    public static Query parse(String query,
                              String[] fields,
                              BooleanClause.Occur[] flags,
                              Analyzer analyzer)
                       throws ParseException

  Deprecated.
  Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

       Usage:
       <code>
       String[] fields = {"filename", "contents", "description"};
       BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
                      BooleanClause.Occur.MUST,
                      BooleanClause.Occur.MUST_NOT};
       MultiFieldQueryParser.parse("query", fields, flags, analyzer);
       </code>

  The code above would construct a query:

       <code>
       (filename:query) +(contents:query) -(description:query)
       </code>

  Parameters:
    `query` - Query string to parse
    `fields` - Fields to search on
    `flags` - Flags describing the fields
    `analyzer` - Analyzer to use
  Throws:
    `ParseException` - if query parsing fails
    `IllegalArgumentException` - if the length of the fields array differs from the length of the flags array

### parse

    public static Query parse(String[] queries,
                              String[] fields,
                              BooleanClause.Occur[] flags,
                              Analyzer analyzer)
                       throws ParseException

  Deprecated.
  Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

       Usage:
       <code>
       String[] query = {"query1", "query2", "query3"};
       String[] fields = {"filename", "contents", "description"};
       BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
                      BooleanClause.Occur.MUST,
                      BooleanClause.Occur.MUST_NOT};
       MultiFieldQueryParser.parse(query, fields, flags, analyzer);
       </code>

  The code above would construct a query:

       <code>
       (filename:query1) +(contents:query2) -(description:query3)
       </code>

  Parameters:
    `queries` - Queries string to parse
    `fields` - Fields to search on
    `flags` - Flags describing the fields
    `analyzer` - Analyzer to use
  Throws:
    `ParseException` - if query parsing fails
    `IllegalArgumentException` - if the length of the queries, fields, and flags array differ

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