VVB
VVB

Reputation: 7641

Can we apply 2 different queries with OR condition to sphinx?

I have below 2 queries

$partialQuery1 = " @co1 txt1 @col2 txt2 @col3 txt3";
$partialQuery2 = " @co1 txt4 @col2 txt5 @col3 txt6";

Now, I want to apply OR like below

$partialQuery3 = $partialQuery1 . " OR(|) " . $partialQuery2;
$cl->Query(partialQuery3, "indexer");

This is giving me zero (0) resuts for now. I am not sure whether it is possible or not in sphinx?

Note : I don't want use below approach

$partialQuery = " @col (txt1 | txt4) ....";

Upvotes: 0

Views: 35

Answers (1)

barryhunter
barryhunter

Reputation: 21091

$partialQuery3 = "(". $partialQuery1 . ") | (" . $partialQuery2 . ")";

The OR operator is simply a pipe char | - the actual word OR is not valid.

Operator precedence means would ALSO need brackets around each partquery (othrwise wouild be (txt3 | txt4) the the middle).

Upvotes: 1

Related Questions