Dear All I have indexed a salary field for all individuals. If I search without any conditions, I get all the records properly.
Now I need to search with conditions. Need to get records where salary is in a particular range.
I am trying a simple code as below.
*$conditions['fq'][0] = 'salary:[2 TO 6]'; $results = apachesolr_search_search_execute($keys, $conditions); * I get almost 90% records correct. But I got few records where salary value is 22. Clearly 22 is not in the range of 2 to 6. Can somebody point out whats the wrong here.
In another case I tried to search as
*$conditions['fq'][0] = 'salary:[2 TO 10]'; $results = apachesolr_search_search_execute($keys, $conditions); * I did not get any record. I wanted to get records where salary is in between 2 to *10*. I do not know whats wrong here, mostly the presence of 10 is creating problem.
Somebody please help.., or at least point to documentation where I can refer and learn.
Best Regards kamal
On 22/05/13 09:21, Kamal Palei wrote:
Dear All I have indexed a salary field for all individuals. If I search without any conditions, I get all the records properly.
Now I need to search with conditions. Need to get records where salary is in a particular range.
I am trying a simple code as below.
*$conditions['fq'][0] = 'salary:[2 TO 6]'; $results = apachesolr_search_search_execute($keys, $conditions);
I get almost 90% records correct. But I got few records where salary value is 22. Clearly 22 is not in the range of 2 to 6. Can somebody point out whats the wrong here.
In another case I tried to search as
*$conditions['fq'][0] = 'salary:[2 TO 10]'; $results = apachesolr_search_search_execute($keys, $conditions);
I did not get any record. I wanted to get records where salary is in between 2 to *10*. I do not know whats wrong here, mostly the presence of 10 is creating problem.
Somebody please help.., or at least point to documentation where I can refer and learn.
If you log SQL statements, you can see the SQL it generates and that will probably lead you to the solution.
I know it's easy to do this with Postgres, I've no idea how easy it is with the alternatives.
John Thanks for reply. I fixed it. It was a mistake by me in schema file. Wrongly I typed salary as text field but I assumed it is long type. Hence search result was not proper.
Thanks again.
BR, kamal
On Wed, May 22, 2013 at 6:51 PM, John Summerfield summer@js.id.au wrote:
On 22/05/13 09:21, Kamal Palei wrote:
Dear All I have indexed a salary field for all individuals. If I search without any conditions, I get all the records properly.
Now I need to search with conditions. Need to get records where salary is in a particular range.
I am trying a simple code as below.
*$conditions['fq'][0] = 'salary:[2 TO 6]'; $results = apachesolr_search_search_execute($keys, $conditions);
I get almost 90% records correct. But I got few records where salary value is 22. Clearly 22 is not in the range of 2 to 6. Can somebody point out whats the wrong here.
In another case I tried to search as
*$conditions['fq'][0] = 'salary:[2 TO 10]'; $results = apachesolr_search_search_execute($keys, $conditions);
I did not get any record. I wanted to get records where salary is in between 2 to *10*. I do not know whats wrong here, mostly the presence of 10 is creating problem.
Somebody please help.., or at least point to documentation where I can refer and learn.
If you log SQL statements, you can see the SQL it generates and that will probably lead you to the solution.
I know it's easy to do this with Postgres, I've no idea how easy it is with the alternatives.
-- [ Drupal support list | http://lists.drupal.org/ ]
On 22/05/13 21:24, Kamal Palei wrote:
Thanks for reply. I fixed it. It was a mistake by me in schema file. Wrongly I typed salary as text field but I assumed it is long type. Hence search result was not proper.
I thought it might have been something of that kind. Logging SQL is a useful technique, just as (on Linux systems) strace and tcpdump cab be sometimes.