I wish do searches using fuzzy search. Using Luke to help me, if I search for a word that has aliases (eg similar words) it all works as expected:
However if I enter a search term that doesn't have any similar words (eg a serial code), the search fails and I get no results, even though it should be valid:
Do I need to structure my search in a different way? Why don't I get the same in the second search as the first, but with only one "term"?
You have not specified Lucene version so I would assume you are using 6.x.x. The behavior that you are seeing is a correct behavior of Lucene Fuzzy Search.
Refer this and I quote ,
Which roughly but not very accurately means that two texts varying with maximum of two characters at any positions would be a returned as match if using
FuzzyQuery
.Below is a sample output from one of my simple Java programs that I illustrate here,
So you should read more about Edit Distance.
If your requirement is to match N-Continuous characters without worrying about edit distance , then N-Gram Indexing using NGramTokenizer is the way to go.
See this too for more about N-Gram