I’m using the default PHP Solr client:
http://php.net/manual/en/book.solr.php
Up until now, the results are amazing so I decided to continue using Solr, and develop a “suggester” service:
I did according to:
http://wiki.apache.org/solr/Suggester/
It’s also working great – but I have no idea how to query it using the PHP client.
This is how I query for documents:
http://localhost:8080/solr/subject_offers/select/?q=string_to_search
This is how I query for suggestions:
http://localhost:8080/solr/subject_offers/suggest/?q=string_to_suggest
As you can see, the suggestion service have a different RequestHandler ( called ‘suggest’).
How can I change it on the client?
Update:
I’m using cURL for retrieving the response XML from Solr.
But I still, want to return a Solr response object, so I’m using “SolrUtils::digestXmlResponse($xml, SolrResponse::PARSE_SOLR_OBJ)”.
Unfortunately I’m getting an error of “Error un-serializing response” for a valid XML:
<response><lst name="responseHeader"><int name="status">0</int><int name="QTime">2</int></lst><lst name="spellcheck"><lst name="suggestions"><lst name="the"><int name="numFound">1</int><int name="startOffset">9</int><int name="endOffset">12</int><arr name="suggestion"><str>the</str></arr></lst><lst name="the"><int name="numFound">1</int><int name="startOffset">33</int><int name="endOffset">36</int><arr name="suggestion"><str>the</str></arr></lst><lst name="collation"><str name="collationQuery">name:for the d^5 description:for the d^0.4</str><int name="hits">1</int><lst name="misspellingsAndCorrections"><str name="the">the</str><str name="the">the</str></lst></lst></lst></lst><result name="response" numFound="1" start="0"><doc><str name="1_on_1_price">9,USD</str><float name="avarage_rating">0.0</float><arr name="categories"><str>2,2,3</str></arr><int name="category_id">3</int><arr name="description"><str>was named for the directo</str><str>The Manchesowned by Peel Ports</str></arr><bool name="is_public">true</bool><str name="language">he</str><int name="lesson_type">0</int><str name="name">was named for the directo</str><int name="subject_id">12</int></doc></result></response>
Please advise,
thanks!
I had the same problem and I found answer in the source code. The solution is: