mirror of
https://github.com/NixOS/nixos-search
synced 2024-11-13 23:47:07 +00:00
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:
parent
eb2910bffa
commit
1ecb696edd
1 changed files with 6 additions and 1 deletions
|
@ -1240,6 +1240,11 @@ searchFields query mainField fields =
|
|||
)
|
||||
|> List.concat
|
||||
|
||||
queryWordsWildCard =
|
||||
(String.replace "_" "-" query :: String.replace "-" "_" query :: queryWords)
|
||||
|> Set.fromList
|
||||
|> Set.toList
|
||||
|
||||
queryWords =
|
||||
String.words (String.toLower query)
|
||||
in
|
||||
|
@ -1271,7 +1276,7 @@ searchFields query mainField fields =
|
|||
)
|
||||
]
|
||||
)
|
||||
queryWords
|
||||
queryWordsWildCard
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue