Multiple Solr filter queries in PHP

I am trying to use facet in solr, i want to make a search on my database and i need to get articles that belong to specific date and specific publisher.

i used this url on the browser: localhost:8888/solr//collection1/select/?q=:&version=2.2&start=0&rows=10&indent=on&facet=true&fq=publisher_name:"Saudi Press Agency (SPA)"&fq=datecreated:20110725

and it works fine. I am using (search()) function in apache_solr_service class in my php code. and i set the array as below:


I know it wont give me the expected results because of fq index, it will overwrite the value of fq into publisher_name

but how can i set this query with two facet queries

asked May 16, 2015 in SOLR by rajesh
0 votes

2 Answers

0 votes
This is what the code should look like (please check for syntax errors, my PHP is rusty): array('facet'=>'true','fq'=>array('datecreated:'.$date,'publisher_name:"'.$publisher.'"')
answered May 16, 2015 by rajesh
0 votes
You could also write it like this:

array('fq'=>'+datecreated:'.$date.' +publisher_name:"'.$publisher.'"')
answered May 16, 2015 by rajesh