views:

53

answers:

2

Using RavenDB to do a query on Lucene Index.

This query parses okay: X:[[a]] AND Y:[[b]] AND Z:[[c]]

However this query gives me a parse exception: X:[[a]] AND Y:[[b]] AND Z:[[c]] AND P:[[d]]

"Lucene.Net.QueryParsers.ParseException: Cannot parse '( AND )': Encountered \" \"AND"

I tried this on complexed index and simple reproduce cases and same result it seems once you go past three ands it blows up. Im using [[]] and not analyzed because i want exact matches (also sometimes values contain whitespace etc..) and from RavenDB I have veyr little control over the indexing.

Im wondering how I can rewrite the query to avoid the parse exception?

A: 

This looks rather like a bug in Lucene's QueryParser, perhaps try reporting this in the user mailing list.

As a bypass, you could create a BooleanQuery manually and add the terms you want yourself. Since they are not analyzed, and the query doesn't look too complicated, you may be better off without the query-parser.

synhershko
A: 

This is now fixed in the latest RavenDB builds. See this thread for more info.

Matt Warren