Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
HSEARCH-2678 Add a simple query string entry point to the DSL #1318
So, this has a very long history as I started to work on this in 2011 :). This patch is very different from what I envisioned at the start.
Why revisit it now? Got kicked out last week of $oldJob GitHub organization and this branch was hosted in the hibernate-search repository of this organization so it was high time to host it in a safe place. While at it, I decided to rebase it, polish it and well... here we are...
The idea of this patch came from the impossibility to execute a plain text query with a AND operator with the
Basically, we had our users entering "word1 word2" as a search query and they wanted only the results containing word1 and word2. We also wanted this to work with multiple fields. Meaning I would want to look for results containing word1 and word2 but either in name or description.
It looks like a simple issue but it's not that simple, especially when analyzers come into play.
Our users might also want to use simple "advanced" query features like phrase queries or negative queries.
I tried several times to arrive to something working well, thought about using DisMax...
The current version of the patch became possible when Lucene introduced the
How it works
You can see a couple of examples in the doc added at the start of this patch. It should give you a good overview of how it works.
I also added a couple of tests that demonstrates the features.
While quite simple by itself, I think it's a great feature for the end user.
Here are my two cents. It's mostly about naming, I'm afraid. But given we're talking about introducing a new API, I'm not sure it's really "bikeshedding"... It's not like naming is a detail when building new APIs.
Looks very good. The only detail I'm not convinced of is the starting point of the DSL:
It feels a bit at odds with the other methods, but not having a better idea I merged it.
Proposal: let's post a dedicated blog to present / explain the feature and see if someone has a better name to offer.