FTS + disjunction and conjunctions

Is there a way in which I could do a query with PHP SDK in which I am having a disjunction and conjunction at the same time?

I could not find any example in the documentation

You would just need to compose the queries accordingly

$conjunction1 = new ConjunctionSearchQuery([$queryA, $queryB]);
$conjunction2 = new ConjunctionSearchQuery([$queryC, $queryD]);

$disjunction = new DisjunctionSearchQuery([$conjunction1, $conjunction2]);
$opts = new SearchOptions();
$res = $cluster->searchQuery("travel-sample-index", $disjunction, $opts);
foreach ($res->rows() as $row) {
    printf("id: %s, score: %f\n", $row['id'], $row['score']);
1 Like

This topic was automatically closed after 90 days. New replies are no longer allowed.