aboutsummaryrefslogtreecommitdiffstats
path: root/modules/indexer/indexer.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/indexer/indexer.go')
-rw-r--r--modules/indexer/indexer.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/modules/indexer/indexer.go b/modules/indexer/indexer.go
new file mode 100644
index 0000000000..1e0f81de89
--- /dev/null
+++ b/modules/indexer/indexer.go
@@ -0,0 +1,54 @@
+// Copyright 2025 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package indexer
+
+type SearchModeType string
+
+const (
+ SearchModeExact SearchModeType = "exact"
+ SearchModeWords SearchModeType = "words"
+ SearchModeFuzzy SearchModeType = "fuzzy"
+ SearchModeRegexp SearchModeType = "regexp"
+)
+
+type SearchMode struct {
+ ModeValue SearchModeType
+ TooltipTrKey string
+ TitleTrKey string
+}
+
+func SearchModesExactWords() []SearchMode {
+ return []SearchMode{
+ {
+ ModeValue: SearchModeExact,
+ TooltipTrKey: "search.exact_tooltip",
+ TitleTrKey: "search.exact",
+ },
+ {
+ ModeValue: SearchModeWords,
+ TooltipTrKey: "search.words_tooltip",
+ TitleTrKey: "search.words",
+ },
+ }
+}
+
+func SearchModesExactWordsFuzzy() []SearchMode {
+ return append(SearchModesExactWords(), []SearchMode{
+ {
+ ModeValue: SearchModeFuzzy,
+ TooltipTrKey: "search.fuzzy_tooltip",
+ TitleTrKey: "search.fuzzy",
+ },
+ }...)
+}
+
+func GitGrepSupportedSearchModes() []SearchMode {
+ return append(SearchModesExactWords(), []SearchMode{
+ {
+ ModeValue: SearchModeRegexp,
+ TooltipTrKey: "search.regexp_tooltip",
+ TitleTrKey: "search.regexp",
+ },
+ }...)
+}