Git Product home page Git Product logo

Comments (4)

bkonkle avatar bkonkle commented on June 23, 2024

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.

notanumber avatar notanumber commented on June 23, 2024

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.

notanumber avatar notanumber commented on June 23, 2024

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.

notanumber avatar notanumber commented on June 23, 2024

Resolved on IRC and git messages.

from xapian-haystack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.