如何在solr中构建可能的互斥fq

how to construct possible mutual exclusive fqs in solr

对 Solr 完全陌生。谁能告诉我这些说法是否正确

&fq=(month:"11" OR month:"12") -> those month in 11 or 12
&fq=month:"11" & fq=month:"12" -> same as above

&fq=month:"11" & fq=-month:"12" -> those month in 11 but not in 12, effectively only 11
&fq=(month:"11" OR -month:"12") -> same as above


&fq=-month:"11" & fq=-month:"12" -> those month not in either 11 or 12
&fq=-(month:"11" OR month:"12")  -> same as above

&fq=month:"11" & fq=-month:"11" -> returns 0 since they are mutual exclusive
&fq=(month:"11" OR -month:"11") -> same as above

并且还会 &fq=(month:"11" OR -month:"11") 降低性能(通过合并月份的结果:“11”与 -month:“11”的结果)或者 solr 可以对 fqs 进行一些分析并在执行之前合并它们实际查询。

你的所有其他陈述都是正确的,但以下是错误的。

&fq=month:"11" & fq=month:"12" -> 所有单独的 fq 子句都被视为 AND 操作,因此,这不会 return 任何结果,除非月份是一个多值字段,文档同时具有 11 和 12 个值。