package search
import "golang.org/x/pkgsite/internal/postgres/search"
Index ¶
Constants ¶
const SymbolTextSearchConfiguration = "symbols"
SymbolTextSearchConfiguration is a custom postgres text search configuration used for symbol search.
Variables ¶
var Content = fmt.Sprintf("" /* 760 byte string literal not displayed */, 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.
Source Files ¶
content.go query.gen.go symbolsearch.go type.go
- Version
- v0.0.0-20250218150137-224a1368cf02 (latest)
- Published
- Feb 18, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 2 months ago –
Tools for package owners.