English 中文(简体)
Lucene Boolean Query on Not ANalyzed Fields
原标题:

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?

问题回答

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

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.





相关问题
Lucene.NET in medium trust

How do I make Lucene.NET 2.3.2 run in a medium trust environment? GoDaddy doesn t like it the way it is.

Grails searchable plugin

In my Grails app, I m using the Searchable plugin for searching/indexing. I want to write a Compass/Lucene query that involves multiple domain classes. Within that query when I want to refer to the id ...

Search subset of objects using Compass/Lucene

I m using the searchable plugin for Grails (which provides an API for Compass, which is itself an API over Lucene). I have an Order class that I would like to search but, I don t want to search all ...

Lucene seems to be caching search results - why?

In my project we use Lucene 2.4.1 for fulltext search. This is a J2EE project, IndexSearcher is created once. In the background, the index is refreshed every couple of minutes (when the content ...

热门标签