I'm trying to write unit tests for Fuzzy matching in my project. However, I have one test that is failing even though it shouldn't according to Lucene documentation. The search term is 2 characters in length, the indexed term is 3 characters in length and the edit distance is 2. According to lucene documentation, this search term should not match on this indexed term as edit distance should be > length of smallest matched term.
The search term is "je", the indexed term is "jon". According to Damareau levenshtein distance which is used by Lucene, the edit distance here is 2. According to Lucene official documentation on FuzzyQuery (https://lucene.apache.org/core/8_1_0/core/org/apache/lucene/search/FuzzyQuery.html) , the edit distance should be greater than the length of the shortest term (search term or indexed term). Therefore by this logic, my search query of "je" should not match on "jon".
As a background, I am using a boolean query with prefixQuery and fuzzyQuery. Partial matching is enabled with prefixQuery, and fuzzy matching with the fuzzyQuery. I am not storing any NGrams or stemming words. I am using a simple standardAnalyzer for indexing and searching.
Lastly, I printed out the explain score for this search result and the explanation seems to have validated my concern that this may be a bug in Lucene. The output for the Explain method is:
"0.0 = sum of: 0.0 = ConstantScore(name:jon)^0.0"
This shows that the calculated relevance score is 0 but yet the result is being matched and returned.
Any experiences with incorrect documentation by Lucene or bugs in the software?