PHP full text search

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.


Given that I’ve not heard anything in the past three weeks, should I assume that nobody really supports or works on the PHP client? I’m thinking at the moment that my best strategy is just to move off PHP to node.js - especially since this is a trivial piece of code.

@gareth PHP Client is fully supported. Apologies that you had to wait for sometime, @avsej can you please assist ?

Thanks. I think I’ve been spoiled by @ingenthr and @daschl answering my Java questions almost before I’ve asked them :slight_smile:

would not doubt that :slight_smile:

Thanks for bug report. The problem will be fixed in PHP SDK 3.0.3, which will be released this week.

@gareth I will keep you posted when its released. Thanks for your patience again, appreciate it!

PHP SDK 3.0.3 has been published today, one of the changes included in it fixes this issue.

1 Like

Thanks. That appears to fix the issue.