Comments (4)
Well, I guess actually it needs to be an AND_NOT with an extra set of () around the subqueries. After a week of working on nothing but this, my head is spinning. :-)
from xapian-haystack.
Sorry it took me so long to respond to this.
I think I see what's going wrong here. The problem is the result of using SQ with exclude. I'm not sure if the issue is with Haystack itself yet, or if it's the Xapian backend. I'll need to speak with Daniel before I can be sure.
In the meantime, I'd recommend building an query that combines exclusion filters and SQ by doing something like:
sqs.filter(~SQ(
SQ(contenttype='events.event) & SQ(date__lte=(today - SITE_SEARCH_EVENTS_FROM) & SQ(date__gte=(today + SITE_SEARCH_EVENTS_TO))
))
from xapian-haystack.
Confirmed that the problem is the exclude(SQ(...))
bit. It's definitely canceling itself out. i.e., what's happening is:
sq.exclude(*args)
actually, internally, calls sq.filter(~SQ(*args))
, so when you pass in a SQ as the arg, you're getting:
sq.filter(~SQ(SQ(foo))
The result; the opposite of what you want.
I think you're best bet is to use filter directly with a ~SQ. This should give you the behaviour you're expecting.
I'm going to keep this ticket open until I get feedback from Daniel, just to be absolutely certain I'm understanding this is working as designed.
from xapian-haystack.
Resolved on IRC and git messages.
from xapian-haystack.
Related Issues (20)
- No result with django_ct filter.
- Release a version compatible with haystack >= 2.5.1 HOT 5
- django-haystack 1.4 HOT 5
- Facetting with facet value containing a slash returns wrong facet counts
- Multiprocess indexing, locking exceptions HOT 3
- install xapian error HOT 3
- No result when app_lable in uppercase HOT 1
- Travis config testing incompatible django / django-haystack
- When trying to install sphinx wih pip or apt for Xapian Haystack, sphinx.main() can't be called. HOT 1
- Indexing signal processor not working correctly in Xapian Haystack (?) HOT 1
- Latest release on pypi.org not reflected in release on github HOT 16
- pypi sdist tarballs don't include tests HOT 3
- How to integrate with a word segmentator system?
- xapian_wheel_builder wheel setup should include more information HOT 1
- Github Actions - coveralls integration needs more work HOT 3
- Github Actions - expand test matrix, unify coverage reports
- 3.0.1 test_highlight fails HOT 9
- Omitting * from end of range doesn't search correctly.
- Database maintenance: compacting
- Error rebuilding index
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xapian-haystack.