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

Exact search problem after updating to latest #152

Open
gremmie opened this issue May 5, 2015 · 1 comment
Open

Exact search problem after updating to latest #152

gremmie opened this issue May 5, 2015 · 1 comment

Comments

@gremmie
Copy link

gremmie commented May 5, 2015

I am upgrading from Haystack 2.1.0 and commit 37add92 of the xapian-backend. I have switched to Haystack 2.3.1 and the latest version of this backend, which at this time is a3a3a4e.

After doing some manual testing I have noticed some different behavior. I do not know if this is a problem with Haystack, the xapian backend, or what...

>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet()
>>> sqs = sqs.filter(content='triceratops')
>>> sqs.count()
2
>>> sqs = SearchQuerySet()
>>> sqs = sqs.filter(content__exact='triceratops')
>>> sqs.count()
0

Under my old environment, both calls to sqs.count() would return the same number of results.

Do you have any thoughts or advice on how to troubleshoot or debug this further?

Thank you!

@gremmie
Copy link
Author

gremmie commented May 6, 2015

I stepped through the code in both my old and new environments and it looks like it is not a Haystack issue. Haystack seems to pass the same parameters in both cases to the backend. However the new backend is building a very different query than before.

The biggest thing I see is that the new code in _query_from_term() does a if field_name == 'content' but then keeps going and falls into the new if/then/else and hits the exact case. The old code only did the content check. So the new code ends up with a 2 element query_list whereas the old code has 1 element. Hope that makes sense.

I'll try to play around with the code some more but I don't quite have the background yet to understand what's going on. Hopefully a dev can take a look at this.

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

1 participant