Unexpected error when a string ends in backslash

37 views
Skip to first unread message

Rob Scott

unread,
Feb 4, 2016, 12:48:13 PM2/4/16
to RavenDB - 2nd generation document database
I recently ran into a puzzling and unexpected error when doing what seemed like a fairly straightforward LINQ query - no advanced Lucene stuff. Here is a much simplified version of the code - pretty straightforward.

var query = session.Query<ExampleIndex.ReduceResult, ExampleIndex>();
var results =
query.Where( x => x.Query == "thing thing \" )
.As<Example>()
.ToList();

However, since the searchText (1) contains a space and (2) ends in a backslash, this query will throw an exception with the following message:

Lucene.Net.QueryParsers.ParseException: Could not parse: 'Name:\"thing thing \\\"'
---> Lucene.Net.QueryParsers.ParseException: Cannot parse 'Name:\"thing thing \\\"':
Lexical error at line 1, column 21.  Encountered: <EOF> after : \"\\\"thing thing \\\\\\\"\"
---> Lucene.Net.QueryParsers.TokenMgrError: Lexical error at line 1, column 21.
Encountered: <EOF> after : \"\\\"thing thing \\\\\\\"\"\r\n   

If I use RavenQuery.Escape() I can avoid the issue, but I thought that was only necessary for advanced Lucene queries.

Any ideas? Thanks!
Rob Scott


Oren Eini (Ayende Rahien)

unread,
Feb 5, 2016, 6:09:03 PM2/5/16
to ravendb
I can't reproduce this.
Here is my test

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RavenDB-4300.cs
Reply all
Reply to author
Forward
Message has been deleted
0 new messages