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

in operator confusing behavior #41

Closed
alecxe opened this issue Jan 18, 2016 · 1 comment
Closed

in operator confusing behavior #41

alecxe opened this issue Jan 18, 2016 · 1 comment

Comments

@alecxe
Copy link

alecxe commented Jan 18, 2016

May be it is just me not understanding something obvious, but why this cannot find a substring in string:

>>> import objectpath
>>> tree = objectpath.Tree({'doc': {'title': 'Purple is Best Color'}})
>>> list(tree.execute('$..*["Purple" in @.title]'))
[]

But, explicitly converting the substring to string with str() works:

>>> list(tree.execute('$..*[str("Purple") in @.title]'))
[{'title': 'Purple is Best Color'}]

Is this a bug or an intended behavior? Thanks!

SO post for the reference: http://stackoverflow.com/questions/34820888/objectpath-trouble-with-in-operator

@adriank
Copy link
Owner

adriank commented Jan 19, 2016

A bug. It's fixed now, but it may break rare queries. If you encounter
anything that I've broken by this hotfix let me know! The fix is available
through github (git clone https://github.com/adriank/ObjectPath.git).

If you have any other questions re ObjectPath, let me know!

Greetings,
Adrian Kalbarczyk

http://kalbarczyk.co/ http://about.me/akalbarczyk

On Mon, Jan 18, 2016 at 4:55 PM, Alexander Afanasyev <
notifications@github.com> wrote:

May be it is just me not understanding something obvious, but why this
cannot find a substring in string:

import objectpath
tree = objectpath.Tree({'doc': {'title': 'Purple is Best Color'}})
list(tree.execute('$..*["Purple" in @.title]'))
[]

But, explicitly converting the substring to string with str() works:

list(tree.execute('$..*[str("Purple") in @.title]'))
[{'title': 'Purple is Best Color'}]

Is this a bug or an intended behavior? Thanks!


Reply to this email directly or view it on GitHub
#41.

@adriank adriank closed this as completed Jan 19, 2016
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