2013-04-19 90 views
0

我沒有在org.apache.lucene.search.BooleanQuery的add方法中區分Occur.SHOULD和Occur.MUST。有人可以解釋嗎?SOLR中Occur.SHOULD和Occur.MUST之間的區別

+0

請在這裏閱讀http://stackoverflow.com/questions/10122733/difference-between-booleanclause-occur-must-and-booleanclause-occur-should-in-lu。這是完全相同的問題,並得到很好的回答。 – cheffe

回答

4

BooleanClause.Occur.Must代表Mandatory子句。該條款應符合要返回的結果。基本上AND

BooleanClause.Occur.SHOULD代表的optional條款,並會表現得像一個OR

對於Solr的BooleanClause.Occur.Must在調試查詢的解釋都標有+BooleanClause.Occur.SHOULD沒有與之相關聯的標誌。