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

problems building (OR)AND query with field names #20

Open
tonymillion opened this issue May 16, 2014 · 2 comments
Open

problems building (OR)AND query with field names #20

tonymillion opened this issue May 16, 2014 · 2 comments

Comments

@tonymillion
Copy link

I'm trying to build a query using the following code:
q = Q(Q('class','comment') | Q('class','post')) & Q('text','things')

I was expecting the output to be:
(class:(post) OR class:(comment)) text:'things'

instead I get:
(class:(comment) class:(post) AND text:(things))

Which is obviously wrong and doesn't work.


For reference a query of:
Q( Q('a')|Q('b')) & Q('text','things')

does actually output the correct query:
((a OR b) AND text:(things))

@wyc
Copy link

wyc commented Oct 11, 2017

Yep, I'm getting the same. Also noticed that the + (must) operator does not encapsulate terms as expected:

>>> q = Q('Mary had a little lamb') & +(Q('author', 'jimmy') | Q('author', 'jack'))
>>> str(q)
'("Mary had a little lamb" AND +author:(jimmy) author:(jack))'

Expected:

'("Mary had a little lamb" AND +(author:(jimmy) OR author:(jack)))'

@ritiksoni00
Copy link

Hey @wyc , hope you are having good one!

can you tell me more about (in case you remember)

  • (must) operator does not encapsulate terms as expected:

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

3 participants