bestFuzzyScore returns the best similarity score between query and the task's ID or title.
(query string, task *model.Task)
| 268 | |
| 269 | // bestFuzzyScore returns the best similarity score between query and the task's ID or title. |
| 270 | func bestFuzzyScore(query string, task *model.Task) float64 { |
| 271 | idScore := calculateSimilarity(query, task.ID) |
| 272 | titleScore := calculateSimilarity(query, task.Title) |
| 273 | if idScore > titleScore { |
| 274 | return idScore |
| 275 | } |
| 276 | return titleScore |
| 277 | } |
| 278 | |
| 279 | // calculateSimilarity returns a similarity score between 0.0 and 1.0. |
| 280 | // Substring containment scores 0.7-1.0; otherwise Levenshtein distance is used. |
no test coverage detected