Giter Site home page Giter Site logo

Comments (7)

jekirl avatar jekirl commented on July 26, 2024

I had a similar problem with ampersands, I was able to fix this by reverting from that nasty regular expression back to the Lucene query builder that properly escapes, for example, using Q:

from lucenequerybuilder import Q
str(reduce(lambda x, y: x & y, [Q(k, v) for k, v in {"props":"Te st"}.iteritems()]))
'props:("Te st")'

Using the regex:

import re
ESCAPE_CHARS_RE = re.compile(r'(?<!\\)(?P<char>[&|+\-!(){}[\]^"~*?:])')
lucene_esc = lambda v: ESCAPE_CHARS_RE.sub(r'\\\g<char>', unicode(v))
','.join([k + ':' + lucene_esc(v) for k, v in {"props" : "Te st"}.items()])
u'props:Te st'

The first query using Q will work, while the second will yield the NullPointerException. I made the changes in my own fork, but I am hesitant to send the pull request due to the re-addition of lucenequerybuilder as a dependency. It would be nice if there were a fix for the regular expression, but in the mean time using Q is a reasonable workaround.

from neomodel.

art-solopov avatar art-solopov commented on July 26, 2024

I confirm this on Python 2.7.
I think this issue should be marked as a bug.

from neomodel.

robinedwards avatar robinedwards commented on July 26, 2024

Thanks guys, perhaps I need to re-introduce lucenequerybuilder I initially pulled it out as it's broken in python 3.

I will look try and look into this asap sorry been a little bit short of time

from neomodel.

robinedwards avatar robinedwards commented on July 26, 2024

Update master now uses lucenquery-builder again. @bluepeppers++ patched lucenequery-builder to support python3 I am just waiting on a release of lucenequery-builder to pypi so I can bump the version number before releasing neomodel.

I tried pinning the github version in the setup.py to no avail so in the mean time I suggest installing lucenequery-builder from git.

from neomodel.

lclarkmichalek avatar lclarkmichalek commented on July 26, 2024

Yeah, I was going to ask for a new release before updating this issue, but never got around to it. I'll ask on the pull request for a version bump.

from neomodel.

lclarkmichalek avatar lclarkmichalek commented on July 26, 2024

The lucene query builder version has been bumped to 0.2, so it should be possible to fix the dependency version now.

from neomodel.

robinedwards avatar robinedwards commented on July 26, 2024

0.3.6 has just been uploaded to pypi with the fix included, sorry for the delay

from neomodel.

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.