PHP中的多个Solr筛选器查询
我试图在solr中使用facet,我想在我的数据库上进行搜索,我需要获得属于特定日期和特定出版商的文章 我在浏览器上使用了此url: localhost:8888/solr//collection1/select/?q=:&version=2.2&start=0&rows=10&indent=on&facet=true&fq=publisher\u name:“沙特新闻社(SPA)”&fq=datecreated:20110725 而且效果很好。我在php代码中使用apache_solr_服务类中的(search())函数。我将数组设置如下: array('facet'=>'true','fq'=>"datecreated:".$date,'fq'=>"publisher_name:\"".$publisher.'"') 数组('facet'=>'true','fq'=>“datecreated:”.$date,'fq'=>“publisher\u name:\”.$publisher.”) 我知道它不会给我预期的结果,因为fq索引,它会将fq的值覆盖到publisher_name中 但是如何使用两个方面的查询设置此查询使用和运算符:PHP中的多个Solr筛选器查询,php,solr,facet,Php,Solr,Facet,我试图在solr中使用facet,我想在我的数据库上进行搜索,我需要获得属于特定日期和特定出版商的文章 我在浏览器上使用了此url: localhost:8888/solr//collection1/select/?q=:&version=2.2&start=0&rows=10&indent=on&facet=true&fq=publisher\u name:“沙特新闻社(SPA)”&fq=datecreated:20110725 而且效果很好。我在php代码中使用apache_solr_服务类
array('fq'=> 'datecreated:'.$date.' AND publisher_name:"'.$publisher.'"');
这可能有助于:
代码应该是这样的(请检查语法错误,我的PHP生锈了):
array('facet'=>'true','fq'=>array('datecreated:'.$date,'publisher\u name:'.$publisher.'')
您也可以这样写:
array('fq'=>'+datecreated:'.$date.' +publisher_name:"'.$publisher.'"')