Skip to content

Commit e729ea9

Browse files
committed
reimplement StatusNotFound json on SearchSimilarNames
1 parent 1eab50a commit e729ea9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

controllers/controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ func SearchSimilarNames(c *gin.Context) {
9595

9696
similarNames, mtf := findSimilarNames(names, name, levenshtein)
9797

98+
if len(names) == 0 {
99+
c.JSON(http.StatusNotFound, gin.H{"Not found": "metaphone not found", "metaphone": mtf})
100+
return
101+
}
102+
98103
//when the similar names result's in less than 5 we search for every similar name of all similar names founded previously
99104
if len(similarNames) < 5 {
100105
for _, n := range similarNames {

0 commit comments

Comments
 (0)