Lucene tập 2

http://lucene.apache.org/java/2_3_2/queryparsersyntax.html

Grouping

Lucene supports using parentheses to group clauses to form sub queries. This can be very useful if you want to control the boolean logic for a query.

To search for either “jakarta” or “apache” and “website” use the query:
(jakarta OR apache) AND website

This eliminates any confusion and makes sure you that website must exist and either term jakarta or apache may exist.

rất hữu ích, hehe, nhờ có cái grouping này mà mình có thể xử lý được yêu cầu của sếp Giang một cách đỡ tốn công sức, hẹ hẹ 😛

Leave a Reply