parse

fun parse(queries: Array<String>, fields: Array<String>, analyzer: Analyzer): Query

Parses a query which searches on the fields specified.

If x fields are specified, this effectively constructs:

` (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx) `

Parameters

queries

Queries strings to parse

fields

Fields to search on

analyzer

Analyzer to use

Throws

if query parsing fails

if the length of the queries array differs from the length of fields array


fun parse(query: String, fields: Array<String>, flags: Array<BooleanClause.Occur>, analyzer: Analyzer): Query

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

Usage:

` String[] fields = {"filename", "contents", "description"};
BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
                BooleanClause.Occur.MUST,
                BooleanClause.Occur.MUST_NOT};
MultiFieldQueryParser.parse("query", fields, flags, analyzer); `

The code above would construct a query:

` (filename:query) +(contents:query) -(description:query) `

Parameters

query

Query string to parse

fields

Fields to search on

flags

Flags describing the fields

analyzer

Analyzer to use

Throws

if query parsing fails

if the length of the fields array differs from the length of flags array


fun parse(queries: Array<String>, fields: Array<String>, flags: Array<BooleanClause.Occur>, analyzer: Analyzer): Query

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

Usage:

` 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); `

The code above would construct a query:

` (filename:query1) +(contents:query2) -(description:query3) `

Parameters

queries

Queries string to parse

fields

Fields to search on

flags

Flags describing the fields

analyzer

Analyzer to use

Throws

if query parsing fails

if the length of the queries, fields, and flags array differ