napoler / solr-php-client

Automatically exported from code.google.com/p/solr-php-client
Other
0 stars 0 forks source link

Params not added correctly to a search #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to perform a regular search using the search method inside the Service 
object
2. Try to add these params: $params["facet"] = "true"; $params["facet.field"] = 
"some_field"; $params["facet.field"] = "some_other_field";

What is the expected output? What do you see instead?
Instead of adding both facet fields to the query string, it'll obviously just 
add the last one, since the keys are the same and the array value will get 
overwritten.

Perhaps the management of $params should be $params[]["key"] = "value"; ? In 
order to avoid these issues. I implemented a quick fix calling it 
$manual_params which take a full query string and append it to the original. 
But there should be something integrated inside the Service class.

What version of the product are you using? On what operating system?
Using SOLR 4.0 (nightly build) on Jetty with Ubuntu 10.10

Original issue reported on code.google.com by php...@gmail.com on 22 Dec 2010 at 10:29

GoogleCodeExporter commented 9 years ago
Supported by making the value of the $params key / value pair array an array 
itself.

From the search phpdoc:

@param array $params key / value pairs for other query parameters (see Solr 
documentation), use arrays for parameter keys used more than once (e.g. 
facet.field)

Also see the FAQ wiki page for example usage exactly for this scenario:

http://code.google.com/p/solr-php-client/wiki/FAQ#How_Can_I_Use_Additional_Param
eters_(like_fq,_facet,_etc)

Hope that helps clear it up.

Original comment by donovan....@gmail.com on 22 Dec 2010 at 2:11

GoogleCodeExporter commented 9 years ago
Oh thank you. I didn't know that... Obviously I'm hasty and no reading all docs.

Thanks again.

Original comment by php...@gmail.com on 22 Dec 2010 at 10:57

GoogleCodeExporter commented 9 years ago
no problem. closing as non issue.

Original comment by donovan....@gmail.com on 23 Dec 2010 at 3:46