We use Lucene.NET to implement a full text search on a clients website. The search itself works already but we now want to implement a modification.
Currently all terms get appended a *
which leads Lucene to perform what I would classify as a StartsWith
search.
In the future we would like to have a search that performs something like a Contains
rather than a StartsWith
.
We use
- Lucene.Net 2.9.2.2
- StandardAnalyzer
- default QueryParser
Samples:
(Title:Orch*)
matches: Orchestra
but:
(Title:rch*)
does not match: Orchestra
We want the first and the second one to both match Orchestra
.
Basically I want the exact opposite of what was asked in this question, I'm not sure why for this person Lucene performed a Contains
and rather than a StartsWith
by default:
Why is this Lucene query a "contains" instead of a "startsWith"?
How can we make this happen?
I have the feeling it has something to do with the Analyzer but I'm not sure.