From: Isidor Z. <cl...@qu...> - 2009-09-18 01:09:53
|
Hi Mike, > Would you mind giving me a very quick example about how to use the > BooleanQuery with 2 fields? > Have a look at the BooleanQuery test suite [1], where plenty of 2 field BooleanQuery instances are created. In your case, you will want to replace the BooleanClause::SHOULD parameter with BooleanClause::MUST (SHOULD will cause the query to match all documents which have either of the two fields, while MUST will require both). Generally, the test suite is a valuable source for code samples to use in own code. And if something is missing, feel free to send more test cases. Best regards, Isidor [1] http://clucene.git.sourceforge.net/git/gitweb.cgi?p=clucene/clucene;a=blob;f=src/test/search/test/search/TestBoolean.cpp;h=0ad11d87eec524eab41a279a5acbb85c39de59b0;hb=ec56f769465b3d51d5b9ceecf3a565d89b59e283 |