Answer the question
In order to leave comments, you need to log in
Search by parameters on Sphinx API (php): need a kick?
Built an index consisting of one text field and several integer ones.
There are no problems with the search in the text: I get the issue. Now we need to narrow the output by setting the bounds on integer values, similar to sql (where `value` between 10 and 20).
I have two integer fields: value and valuemax. Both default to 0. I need to select records that meet a condition (value > 30 and valuemax < 100). But: in this case, the valuemax may be empty and equal to 0. In this case, how to include records whose valuemax is not filled?
The SetFilterRange method allows you to filter a single field. Let's say we set the borders like this:
$Sphinx->SetFilterRange('value', 30, 100);
$Sphinx->SetFilterRange('valuemax', 30, 100);
Answer the question
In order to leave comments, you need to log in
OR is not supported only on the right side (after where). However, nothing prevents you from making the necessary expression in the select-list and aliasing it.
(like select ... (attr OR attr between 30 and 100) as expr... where expr...)
Dig towards setSelect
www.php.net/manual/en/sphinxclient.setselect.php
$->setSelect("*, (30 to 100) OR (0) as myfilter");
$->setFilter("myfilter",array(1));
It is possible through sphinxql request.
At the moment the truth is not supported by OR, but since you have integer values and there are not very many of them, then you can try to do it through IN for the time being.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question