Hi there,
We’re using a bucket containing restaurants. I’ve created an FTS index to search within this bucket using several properties of the restaurant, such as the name, city, and zipcode.
If I look for e.g. Thai restaurants using the Couchbase Console and the search query “*thai rest*” (without quotes) I get about 3000 results.
I am unsure how to get the same results using the PHP SDK.
Excerpt from PHP file:
var_dump($searchText);
$searchQuery = new SearchQuery('idx_search_company_name', SearchQuery::wildcard($searchText));
$result = $bucket->query($searchQuery);
var_dump($result); die();
Note that the index is named incorrectly (for now), we added the other properties later.
The result when executing this code is:
string(11) "\*thai rest*"
object(stdClass)#217 (4) {
["hits"]=>
array(0) {
}
["status"]=>
array(3) {
["total"]=>
int(6)
["failed"]=>
int(0)
["successful"]=>
int(6)
}
["facets"]=>
array(0) {
}
["metrics"]=>
array(3) {
["total_hits"]=>
int(0)
["max_score"]=>
float(0)
["took"]=>
int(67614312)
}
}
If I search for restaurtants using the text ‘terdam’, I get the same results [restaurants from both Amsterdam and Rotterdam (and possibly others)], both using the SDK and console, so I am fairly certain I am using the right bucket and the wildcards themselves work.
How do I search for multiple words with wildcards using the PHP SDK?