sngrl / sphinxsearch

Sphinx Search for Laravel 5
MIT License
124 stars 89 forks source link

spinx search greater then less condition #8

Open jaskaran87 opened 8 years ago

jaskaran87 commented 8 years ago

I want to implement greater then and less then condition in sphinx search

I have one table contain job

    id   | job_title      | min_experience | max_experience 
    101  | php Developer  | 4              | 10
    102  | PHP Developer  | 6              | 9
    103  | PHP Developer  | 4              | 5

If user search with 7 year to 8 year experience jobs then 2 (101 and 102) records will display because in these records range are between them. How can I implement this logic on sphinx search. Please if you have an idea share.

there is a setFilterRange range but it will work on one field

If I will implement this


    $sphinx->setFilterRange("min_experience", 7 , 8);  
    // no result  because both are less then 7

    $sphinx->setFilterRange("min_experience", 7 , 8); 
    // no result will display because max experience is 10 or 9

But both records are valid

http://stackoverflow.com/questions/37608667/spinx-search-greater-then-less-condition