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?
The documentation for the specific overload of
MultiFieldQueryParser.Parsethat you are using states the following: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.