anonymous user

Forums   Register   Login   Forgot your login/password?   Search

Multiple SetFilterRange

Common forum | 1 | 2 | 3 | 4 | 5 | ... | 450 | 451 | 452 | 453 | next »» | Create new thread

ItalicBold

Name: -
Posts: 3

2012-06-28 17:18:52 | reply!


Hi is it possible to stack multiple SetFilterRange against the same attribute?

To eg filter a field on ranges (2 to 4) and (6 to 8)?

barryhunter

Name: Barry Hunter
Posts: 5560

to: ItalicBold, 2012-06-28 17:31:05 | reply!


> Hi is it possible to stack multiple SetFilterRange against the same attribute?
>

No.


> To eg filter a field on ranges (2 to 4) and (6 to 8)?

But can use setSelect

$->setSelect("*, (2 to 4) OR (6 to 8) as myfilter");
$->setFilter("myfilter",array(1));

:)

barryhunter

Name: Barry Hunter
Posts: 5560

to: ItalicBold, 2012-06-28 17:33:39 | reply!


Oops, mistake in last post, actully needs something more like



$->setSelect("*, (att >= 2 AND att <= 4) OR (att >= 6 AND att <= 8) as myfilter");


:)

barryhunter

Name: Barry Hunter
Posts: 5560

to: ItalicBold, 2012-06-28 17:35:40 | reply!


> To eg filter a field on ranges (2 to 4) and (6 to 8)?

Although that could be rewritten as:

$->setFilterRange('att',2,8);
$->setFilter('att',array(5),true);

:)

(use boolean logic to avoid the need for 'OR' - and rewrite as 'AND' possibly combined
with 'NOT')

ItalicBold

Name: -
Posts: 3

to: barryhunter, 2012-06-28 17:46:39 | reply!


> > To eg filter a field on ranges (2 to 4) and (6 to 8)?
>
> Although that could be rewritten as:
>
> $->setFilterRange('att',2,8);
> $->setFilter('att',array(5),true);
>
> :)
>
> (use boolean logic to avoid the need for 'OR' - and rewrite as 'AND' possibly combined
> with 'NOT')
>

Thanks I found and am using the following approach:
http://sphinxsearch.com/forum/view.html?id=474

Common forum | 1 | 2 | 3 | 4 | 5 | ... | 450 | 451 | 452 | 453 | next »» | Create new thread