Reputation: 1368
Can i pass multiple index fields in a Querparser in Lucene? I have done something like this
QueryParser queryParser = MultiFieldQueryParser.Parse(new[] { query }, new[] { "Name", "Description", "ExternalIdentifier", "OriginalFileName", "Text" }, new StandardAnalyzer());
queryParser.setDefaultOperator(QueryParser.Operator.AND);
But it shows some error? i am little bit confused can anybody give me a help?
Upvotes: 1
Views: 1648
Reputation: 4101
The documentation for the specific overload of MultiFieldQueryParser.Parse
that you are using states the following:
IllegalArgumentException
- if the length of the queries, fields, and flags array differ.
I suspect you are getting this exception as you have one query and 5 fields. If this is the method that you want to use, you must provide an array of queries with a length of five.
You may want to use a different parse overload, which will take a single query but multiple fields and flags.
Upvotes: 2