1

I've noticed a weird parsing problem with ravendb's python client. when i use this query

query_result = list(session.query().where_equals("url",url).select("Id","htmlCode","url"))

knowing that url = "http://www.mywebsite.net/"

The relevent part of the error stack is the following :

  File "/usr/local/lib/python3.5/dist-packages/pyravendb/store/session_query.py", line 71, in __iter__
    return self._execute_query().__iter__()
  File "/usr/local/lib/python3.5/dist-packages/pyravendb/store/session_query.py", line 307, in _execute_query
    includes=self.includes)
  File "/usr/local/lib/python3.5/dist-packages/pyravendb/d_commands/database_commands.py", line 286, in query
    raise exceptions.ErrorResponseException(response["Error"][:100])
pyravendb.custom_exceptions.exceptions.ErrorResponseException: Lucene.Net.QueryParsers.ParseException: Could not parse: 'url:http://www.mywebsite.net/' ---> 

BUT if I simply add a simple ' ' to the url parameter in the query, it works without any parsing error (but dosent returns a result though since syntax isnt the same).

I would like to contribute to the pyravendb on github but I'm not sure where it's parsing the parameters, it's probably calling lucene for that.

Any idea why a simple space can prevent proper parsing ?

0

1 Answer 1

3

The query you send to lucene is this url:http://www.mywebsite.net/

lucene key will be the url and the value suppose to be http://www.mywebsite.net/ because you have : in http://www.mywebsite.net/ the lucene parser get "confused" and raise a parsing error.(split key,value special character is :)

To fix your problem you need to escape the : in your url parameter and then give it to the query so your url parameter should look like this: http\://www.mywebsite.net/

For your question why simple space can prevent proper parsing is because space in lucene indicates about another parameter to look for. (you can see what query we build when you using the where_in method)

This issue will be fixed in the next version of pyravendb (current version is 1.3.1.1)

Sign up to request clarification or add additional context in comments.

2 Comments

that's what i did. I will use it as a temporary fix until the next pyravendb is pushed to pip :) Happy to (kind of) contribute in fixing "bugs" in Raven ! Thank you !
I fixed it you can update your pyravendb. just don't forget to remove the escaping

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.