I have this sample (just a snip where the MultiPhraseQuery is built):
// *** MultiPhraseQuery ***
MultiPhraseQuery mQuery = new MultiPhraseQuery();
// *** TermL1 ***
mQuery.add(new Term[] {
new Term("abstract", "quick"),
new Term("abstract", "fast")
});
// *** TermL2 ***
Term t1 = new Term("abstract", "fox");
Term t2 = new Term("abstract", "rabbit");
Term[] termL2 = new Term[] {
t1, t2
};
mQuery.add(termL2);
I'd like to build TermL2 with an iterative method (like a loop) to allow to add a dynamic number of terms (t1, t2, t..., tn). It doesn't seem to be such an hard problem but I haven't any found a solution since a while now.