[hibernate-dev] Search - Plain text and SimpleQueryParser

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


Hi,

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
https://hibernate.atlassian.net/browse/HSEARCH-917).

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:
https://github.com/openwide-java/hibernate-search/commit/ee776744760d8115965a05c939227d24133b58ec
(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.

-- 
Guillaume


More information about the hibernate-dev mailing list