I have some code which worked with PHP Client 2 and Couchbase Server 5.0. I’ve upgraded to Couchbase Server 6.5 and it doesn’t work any more because of some unrecognized response from the server.
Fair enough; it’s short enough that I’ll upgrade to PHP Client 3. But it doesn’t seem to work quite as described. I tried looking at the full PHP documentation, but it doesn’t seem to be there.
What I think I want is:
$searchTerms = "sloth";
$matchQuery = new \Couchbase\QueryStringSearchQuery($searchTerms);
$result = $cluster->searchQuery("keywords", $matchQuery);
but that doesn’t work because of this:
Fatal error: Uncaught Couchbase\BaseException: LCB_ERR_PARSING_FAILURE (208) in Standard input code:56
Stack trace:
#0 Standard input code(56): Couchbase\Cluster->searchQuery('keywords', Object(Couchbase\QueryStringSearchQuery))
#1 {main}
thrown in Standard input code on line 56
So I made it closer to the introduction:
$matchQuery = new \Couchbase\MatchSearchQuery($searchTerms);
$result = $cluster->searchQuery("keywords", $matchQuery);
But that doesn’t seem to return me anything useful. It returns a rows array, but that just has counts, but no ids or scores, unlike the example.
I haven’t put too much effort into my index, but when I access it from the console, it works and I get back four hits with the ids and I can see the query going back and forth to the server in the Chrome DevTools.
Since the PHP client is built on top of the C client, I tried looking at that, but I couldn’t find any C API docs that I understood either.
So I think I’m stuck and I’m not really sure what to do. Let me know if you need more info or if there are some logs or something.
Thanks