parse
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 strings to parse
Fields to search on
Analyzer to use
Throws
if query parsing fails
if the length of the queries array differs from the length of fields array
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 string to parse
Fields to search on
Flags describing the fields
Analyzer to use
Throws
if query parsing fails
if the length of the fields array differs from the length of flags array
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 string to parse
Fields to search on
Flags describing the fields
Analyzer to use
Throws
if query parsing fails
if the length of the queries, fields, and flags array differ