Hi,
I have two question regarding phrase query :
1) How can I execute a phrase query over multiple fields ? I can only
get PhraseQuery to work over a single field - For eg something like
this :
PhraseQuery query = new PhraseQuery();
query.setSlop(10);
String[] phrase = { "george", "bush" };
for (String word : phrase) {
query.add(new Term(field, word));
}
2) Is there a way to execute a phrase query along with
MultiFieldQueryParser ? So if I have a query {A B} and fields F1 and
F2, I want the query to be something like this :
(F1:A F2:A) (F1:B F2:B) (F1:"A B"~10 F2:"A B"~10)
MultiFieldQueryParser queryParser = new MultiFieldQueryParser(
Version.LUCENE_30, fields, new SnowballAnalyzer(
Version.LUCENE_30, "English"),
boosts);
Query query = queryParser.parse(queryString);
Thanks,
amg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]