JaroWinklerDistance returns 0f when s1.length()=s2.length()=0 [LUCENE-2827]
Open
affects-version:4.0-ALPHA
legacy-jira-priority:Major
module:suggest
type:bug
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
StringDistance sd = new JaroWinklerDistance();
System.out.println(sd.getDistance("",""));
console prints 0.
but when use LevensteinDistance or NGramDistance, that console prints 1.0
---
Migrated from [LUCENE-2827](https://issues.apache.org/jira/browse/LUCENE-2827) by tom liu
Environment:
```
JDK1.6.17
```
Contributor guide
Research direction
Start by reproducing JaroWinklerDistance.getDistance("", "") and compare its result with LevensteinDistance and NGramDistance, as shown in the issue. Trace the Jaro-Winkler implementation and add a regression test for two empty strings; done means it returns 1.0 consistently with the other distance implementations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100