[support] Drupal 7 apache solr search filer ...

Kamal Palei palei.kamal at gmail.com
Thu May 23 06:58:39 UTC 2013


Dear All
I am trying to write a search filter for a field having a value in a range
or a specific value.

Say if I want to have a filter like
1. Select profiles with salary 5 to 10  or Salary 0.

So I expect profiles having salary either 0 , 5, 6, 7, 8, 9, 10 etc.

To do this, I have written code as below.


    $index = 0;
    if($include_0_salary == 1)
    {
        $conditions['fq'][$index++] = 'salary:[' . $min_ctc . '+TO+' .
        $max_ctc . ']+OR+salary:0';
    }
    else
    {
        $conditions['fq'][$index++] = 'salary:[' . $min_ctc . ' TO ' .
$max_ctc . ']';
    }

    $results = apachesolr_search_search_execute($keys, $conditions);

When $include_0_salary is false, it gives me expected result. When
$include_0_salary is true, solr server crashes.

I am sure, the way I am setting the fq param, is not proper. Has somebody
done this previously, kindly help, suggest me whats the right syntax.

Thanks
kamal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130523/5d2266e9/attachment.html 


More information about the support mailing list