Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django-Haystack less than or equal to is not working properly #1679

Open
2 tasks
sharzzsharon opened this issue Jun 6, 2019 · 2 comments
Open
2 tasks

Django-Haystack less than or equal to is not working properly #1679

sharzzsharon opened this issue Jun 6, 2019 · 2 comments

Comments

@sharzzsharon
Copy link

  • Tested with the latest Haystack release
  • Tested with the current Haystack master branch

Expected behaviour

I am using django-haytsack in my django-application. I have to filter Searchqueryset based on salary which is a integer field. Trying to filter using lte but its not giving proper result.

Actual behaviour

if i give filter(salary__lte=int(min_sal) ,where min_sal=5000,Its give results for 1000,13000,13000,354675.

models.py

class UserSkillsProfile(models.Model):
...
salary = models.IntegerField(blank=True, null=True)

search_inndexes.py

class UserSkillsProfileIndex(indexes.SearchIndex, indexes.Indexable):
...
salary = indexes.IntegerField(model_attr='salary',null=True)

Query

  search_models = [UserSkillsProfile]
  qs = SearchQuerySet().order_by('last_updated_time').filter(salary__lte=int(min_sal)).models(
                *search_models)

Configuration

  • Operating system version:ubuntu 14.04 KTS
  • Python version:3.6.8
  • Django version:2.1.2
  • Haystack version:2.4.1
@acdha
Copy link
Contributor

acdha commented Jun 6, 2019

Can you test this with the latest Haystack release? Which search engine backend are you using? Do you have a reproducible test case?

@sharzzsharon
Copy link
Author

Can you test this with the latest Haystack release? Which search engine backend are you using? Do you have a reproducible test case?

I am new to haystack. Iam using Elasticsearch as SearchEngine and Postgres sql as backend. Currently I am not using any test cases. I tried with haystack 2.4.1 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants