MCPcopy Index your code
hub / github.com/coder/coder / processTokens

Function processTokens

coderd/searchquery/search.go:837–851  ·  view source on GitHub ↗

processTokens takes the split tokens and groups them based on a delimiter (':'). Tokens without a delimiter present are joined to support searching with spaces. Example Input: ['deprecated:false', 'test', 'template'] Example Output: ['deprecated:false', 'test template']

(tokens []string)

Source from the content-addressed store, hash-verified

835// Example Input: ['deprecated:false', 'test', 'template']
836// Example Output: ['deprecated:false', 'test template']
837func processTokens(tokens []string) []string {
838 var results []string
839 var nonFieldTerms []string
840 for _, token := range tokens {
841 if strings.Contains(token, string(':')) {
842 results = append(results, token)
843 } else {
844 nonFieldTerms = append(nonFieldTerms, token)
845 }
846 }
847 if len(nonFieldTerms) > 0 {
848 results = append(results, strings.Join(nonFieldTerms, " "))
849 }
850 return results
851}

Callers 1

searchTermsFunction · 0.85

Calls 1

ContainsMethod · 0.45

Tested by

no test coverage detected