Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP中的多个Solr筛选器查询_Php_Solr_Facet - Fatal编程技术网

PHP中的多个Solr筛选器查询

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_服务类

我试图在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中

但是如何使用两个方面的查询设置此查询

使用和运算符:

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.'"')