I'm examining the following search problem. Consider a document with two
multi-value fields.

 

Document doc = new Document();

 

doc.add(new Field("f1", "a1", Field.Store.YES, Field.Index.ANALYZED));
doc.add(new Field("f1", "a2", Field.Store.YES, Field.Index.ANALYZED));
doc.add(new Field("f1", "a3", Field.Store.YES, Field.Index.ANALYZED));

 

doc.add(new Field("f2", "b1", Field.Store.YES, Field.Index.ANALYZED));
doc.add(new Field("f2", "b2", Field.Store.YES, Field.Index.ANALYZED));
doc.add(new Field("f2", "b3", Field.Store.YES, Field.Index.ANALYZED));

 

The following search expression is applied:

f1:ax AND f2:by

where x, y  is 1,2, or 3.

 

Thus  the search condition f1:a2 AND f2:b2 should return the above document
whereas  the  condition  f1:a1  AND f2:b2 should return no result. Thus the
search  should  return  the  document if and only if the conditions of each
field are satisfied at the same "index" level.

 

Does anyone have an idea how to solve this problem using Lucene/Java?

 

Thanks

HGB

 

Reply via email to