>>> marketing = User.search do |s|
>>> s.fulltext "Marketing"
>>> end
>>> marketing.total
1448
>>> sales = User.search do |s|
>>> s.fulltext "Sales"
>>> end
>>> sales.total
567
>>> marketing_and_sales = User.search do |s|
>>> s.fulltext "Marketing AND Sales"
>>> end
>>> marketing_and_sales.total
945
>>> marketing_or_sales = User.search do |s|
>>> s.fulltext "Marketing OR Sales"
>>> end
>>> marketing_or_sales.total
945
<Sunspot::Search:{:fq=>["type:User"], :q=>"Marketing AND Sales", :fl=>"* score", :qf=>"textfield1 textfield2 textfield3", :defType=>"dismax", :start=>0, :rows=>30}>
我想要简单的布尔查询来处理太阳黑子轨道,我尝试了很多可能性,而不是简单地接受它。
AND 和 NOT 似乎按照 dismax 配置工作。我怎样才能使 OR 查询工作。
提前致谢。