[hibernate-dev] Search - Plain text and SimpleQueryParser

Guillaume Smet guillaume.smet at gmail.com
Wed May 13 07:56:55 EDT 2015


Having some spare time, I revisited my patch that used the Lucene
SimpleQueryParser to provide more advanced search features to the end user.

At my company, our search requirements are usually the following:
- a full text search on the name and description;
- a set of dropdown choices.

Our full text search uses the AND operator as our customers usually
requires this. It's not something we can do with the current keyword()
search (I described the issue at length in

We often give the ability to use boolean operators and phrase queries to
the end user.

How did we expose this feature? We build a Lucene query using the
MultiFieldsQueryParser and we set the default operator to AND. We can't use
the DSL.

Starting with Lucene 4, we have a nice parser which is called
SimpleQueryParser and which is... simple and resilient. And I think it
would be a good idea to expose it via the DSL.

It currently looks like this:
(there's not much code, Lucene is doing the magic).

There are a couple of XXX I would like to discuss and I'm not that thrilled
with the names I gave to the options.

I have some spare time this week and next week so I'll be able to polish
the patch based on your feedback!

Have a nice day.


More information about the hibernate-dev mailing list