Documentation
¶
Index ¶
Constants ¶
View Source
const SymbolTextSearchConfiguration = "symbols"
SymbolTextSearchConfiguration is a custom postgres text search configuration used for symbol search.
Variables ¶
View Source
var Content = fmt.Sprintf(`// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated with go generate -run gen_query.go. DO NOT EDIT. package search // querySearchSymbol is used when the search query is only one word, with no dots. // In this case, the word must match a symbol name and ranking is completely // determined by the path_tokens. %s // querySearchPackageDotSymbol is used when the search query is one element // containing a dot, where the first part is assumed to be the package name and // the second the symbol name. For example, "sql.DB" or "sql.DB.Begin". %s // querySearchMultiWordExact is used when the search query is multiple elements. %s `, formatQuery("querySearchSymbol", SymbolQuery(SearchTypeSymbol)), formatQuery("querySearchPackageDotSymbol", SymbolQuery(SearchTypePackageDotSymbol)), formatQuery("querySearchMultiWordExact", SymbolQuery(SearchTypeMultiWordExact)))
Functions ¶
func SymbolQuery ¶
func SymbolQuery(st SearchType) string
SymbolQuery returns a symbol search query to be used in internal/postgres. Each query that is returned accepts the following args: $1 = query $2 = limit $3 = only used by multi-word-exact for path tokens
Types ¶
type InputType ¶
type InputType int
InputType is the type determined for the search query input.
const ( // InputTypeNoMatch indicates that there is no situation where we will get // results for this search input. InputTypeNoMatch InputType = iota // InputTypeNoDot indicates that the query type is <symbol>. // // If the search input contains only 1 word with no dots, it must be the // symbol name. InputTypeNoDot // InputTypeOneDot indicates that the query type is <package>.<symbol> or // <type>.<fieldOrMethod>. // // If the search input contains only 1 word split by 1 dot, the search must // either be for <package>.<symbol> or <type>.<methodOrFieldName>. InputTypeOneDot // InputTypeTwoDots indicates that the query type is // <package>.<type>.<fieldOrMethod>. // // If the search input contains only 1 word split by 1 dot, the search must // be for <package>.<type>.<methodOrFieldName>. // TODO(golang/go#44142): This could also be a search for // <package-path>.<symbol>, but that case is not currently handled. InputTypeTwoDots // InputTypeMultiWord indicates that the query has multiple words. InputTypeMultiWord )
func ParseInputType ¶
ParseInputType parses the search query input and returns the InputType. The InputType determines which symbol search query will be run.
type SearchType ¶
type SearchType int
SearchType is the type of search that will be performed, based on the input type.
const ( // SearchTypeSymbol is used for InputTypeNoDot (input is <symbol>) or // InputTypeOneDot (input is <type>.<fieldOrMethod>). SearchTypeSymbol SearchType = iota // SearchTypePackageDotSymbol is used for // InputTypeNoDot (input is <package>.<symbol>) or // InputTypeTwoDots (input is <package>.<type>.<fieldOrMethod>). SearchTypePackageDotSymbol // SearchTypeMultiWordOr is used for InputTypeMultiWord when the // search query cannot be used to generate a reasonable number of symbol // and path token combinations. In that case, an OR search is performed on // all of the words in the search input. SearchTypeMultiWordOr // SearchTypeMultiExact is used for InputTypeMultiWord when the search // query can be used to construct a reasonable number of symbol and path // token combinations. In that case, multiple queries are run in parallel // and the results are combined. SearchTypeMultiWordExact )
func (SearchType) String ¶
func (st SearchType) String() string
String returns the name of the search type as a string.
Click to show internal directories.
Click to hide internal directories.