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
http://wiki.apache.org/solr/SolrQuerySyntax
On Thu, May 23, 2013 at 12:28 PM, Kamal Palei palei.kamal@gmail.com wrote:
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
- 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
-- [ Drupal support list | http://lists.drupal.org/ ]
Looks it is impossible to have two OR queries in single fq filter. Has anybody done this previously?
Thanks kamal
On Thu, May 23, 2013 at 12:46 PM, Chandra Shekhar chandrashekhar@srijan.inwrote:
http://wiki.apache.org/solr/SolrQuerySyntax
On Thu, May 23, 2013 at 12:28 PM, Kamal Palei palei.kamal@gmail.comwrote:
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
- 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
-- [ Drupal support list | http://lists.drupal.org/ ]
-- Warm regards, Chandra Shekhar
Srijan Technologies Pvt. Ltd. 303 Solitaire Plaza, Near Guru DronaCharya Metro station Gurgaon -122002 Haryana website : www.srijan.in
Wordpress : http://ananddhara.wordpress.com Twitter : http://twitter.com/ananddhara Scribd : http://www.scribd.com/ananddhara Facebook : http://www.facebook.com/ananddhara