Improve search results with underscore and dash/hyphen package names (#649)

* Create underscore & dash separated variants for wildcard search

* frontend: simplify list uniqueness

---------

Co-authored-by: Naïm Favier <n@monade.li>
This commit is contained in:
Marco Daniel Martins 2023-04-25 17:07:49 +02:00 committed by GitHub
parent eb2910bffa
commit 1ecb696edd
Failed to generate hash of commit

View file

@ -1240,6 +1240,11 @@ searchFields query mainField fields =
) )
|> List.concat |> List.concat
queryWordsWildCard =
(String.replace "_" "-" query :: String.replace "-" "_" query :: queryWords)
|> Set.fromList
|> Set.toList
queryWords = queryWords =
String.words (String.toLower query) String.words (String.toLower query)
in in
@ -1271,7 +1276,7 @@ searchFields query mainField fields =
) )
] ]
) )
queryWords queryWordsWildCard
) )