Skip to content

Commit 21ee5f8

Browse files
committed
Lowercased names to prevent export.
1 parent e21c9a4 commit 21ee5f8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

commands/lib/search.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func LibrarySearch(ctx context.Context, req *rpc.LibrarySearchRequest) (*rpc.Lib
3838
return searchLibrary(req, lm), nil
3939
}
4040

41-
// MatcherTokensFromQueryString parses the query string into tokens of interest
41+
// matcherTokensFromQueryString parses the query string into tokens of interest
4242
// for the qualifier-value pattern matching.
43-
func MatcherTokensFromQueryString(query string) []string {
43+
func matcherTokensFromQueryString(query string) []string {
4444
escaped := false
4545
quoted := false
4646
tokens := []string{}
@@ -75,9 +75,9 @@ func MatcherTokensFromQueryString(query string) []string {
7575
return tokens
7676
}
7777

78-
// DefaulLibraryMatchExtractor returns a string describing the library that
78+
// defaulLibraryMatchExtractor returns a string describing the library that
7979
// is used for the simple search.
80-
func DefaultLibraryMatchExtractor(lib *librariesindex.Library) string {
80+
func defaultLibraryMatchExtractor(lib *librariesindex.Library) string {
8181
res := lib.Name + " " +
8282
lib.Latest.Paragraph + " " +
8383
lib.Latest.Sentence + " " +
@@ -88,16 +88,16 @@ func DefaultLibraryMatchExtractor(lib *librariesindex.Library) string {
8888
return res
8989
}
9090

91-
// MatcherFromQueryString returns a closure that takes a library as a
91+
// matcherFromQueryString returns a closure that takes a library as a
9292
// parameter and returns true if the library matches the query.
93-
func MatcherFromQueryString(query string) func(*librariesindex.Library) bool {
93+
func matcherFromQueryString(query string) func(*librariesindex.Library) bool {
9494
// A qv-query is one using <qualifier>[:=]<value> syntax.
9595
qvQuery := strings.Contains(query, ":") || strings.Contains(query, "=")
9696

9797
if !qvQuery {
9898
queryTerms := utils.SearchTermsFromQueryString(query)
9999
return func(lib *librariesindex.Library) bool {
100-
return utils.Match(DefaultLibraryMatchExtractor(lib), queryTerms)
100+
return utils.Match(defaultLibraryMatchExtractor(lib), queryTerms)
101101
}
102102
}
103103

@@ -131,7 +131,7 @@ func MatcherFromQueryString(query string) func(*librariesindex.Library) bool {
131131
{"website", func(lib *librariesindex.Library) string { return lib.Latest.Website }},
132132
}
133133

134-
queryTerms := MatcherTokensFromQueryString(query)
134+
queryTerms := matcherTokensFromQueryString(query)
135135

136136
return func(lib *librariesindex.Library) bool {
137137
matched := true
@@ -155,7 +155,7 @@ func MatcherFromQueryString(query string) func(*librariesindex.Library) bool {
155155
}
156156

157157
if !knownQualifier {
158-
matched = (matched && utils.Match(DefaultLibraryMatchExtractor(lib), []string{term}))
158+
matched = (matched && utils.Match(defaultLibraryMatchExtractor(lib), []string{term}))
159159
}
160160
}
161161
return matched
@@ -169,7 +169,7 @@ func searchLibrary(req *rpc.LibrarySearchRequest, lm *librariesmanager.Libraries
169169
query = req.GetQuery()
170170
}
171171

172-
matcher := MatcherFromQueryString(query)
172+
matcher := matcherFromQueryString(query)
173173

174174
for _, lib := range lm.Index.Libraries {
175175
if matcher(lib) {

0 commit comments

Comments
 (0)