Comments (7)
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.
I confirm this on Python 2.7.
I think this issue should be marked as a bug.
from neomodel.
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.
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.
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.
The lucene query builder version has been bumped to 0.2, so it should be possible to fix the dependency version now.
from neomodel.
0.3.6 has just been uploaded to pypi with the fix included, sorry for the delay
from neomodel.
Related Issues (20)
- Provide "light" options for inspection script HOT 1
- Incorrect query for count of objects HOT 2
- AttributeError: 'SpecificNode' object has no attribute 'unique_relation' HOT 2
- Relationship properties marked with db_property are skipped during inflation HOT 1
- Structured Node `__eq__` works incorrectly for non-persisted nodes.
- Unable to access property values on nodes that inherit from SemiStructuredNode HOT 1
- neomodel_inspect_database - Only writes first relationship HOT 2
- Missing import in contrib __init__ HOT 1
- Neomodel trying to connect to localhost, even if the database is on Aura ( When calling NODE_NAME.nodes.all() ) HOT 2
- `UniqueIdProperty` makes `get_or_create()` function does not work as expected HOT 2
- zero or more relationships in either direction of type RELATIONSHIP_NAME on node (4:2c06737f-f675-4209-a253-42d649d5fc59:395) of class 'NODE_LABEL'
- `Database` was removed from `neomodel.util` and moved into `neomodel.sync_.core` HOT 4
- Cant retrieve additional relations using `fetch_relations` HOT 6
- neomodel_inspect_database does not correctly report date property
- async iterating over nodes is not working HOT 5
- neomodel_inspect_database RelationshipTo model as string HOT 1
- Make async iterator fully async
- concurrent async calls of `get_or_create` lead to duplicate nodes HOT 1
- Test integration of cachetools
- Add support for full-text index creation
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 neomodel.