search

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFacetFilter

func AddFacetFilter(opts *Options, fieldName string, values []string)

AddFacetFilter adds a facet filter to the search options

func BuildSearchRequest

func BuildSearchRequest(opts *Options) components.SearchRequest

BuildSearchRequest converts Options into a components.SearchRequest without executing it. Used by --dry-run to show the exact request that would be sent.

func GetTimezoneOffset

func GetTimezoneOffset() int

GetTimezoneOffset returns the current timezone offset in minutes

func RunSearch

func RunSearch(ctx context.Context, opts *Options, sdk *glean.Glean, w io.Writer) error

RunSearch executes a search and writes the results as JSON to w.

func RunSearchSDK

func RunSearchSDK(ctx context.Context, opts *Options, sdk *glean.Glean) (*components.SearchResponse, error)

RunSearchSDK executes a search and returns the raw SDK response for the caller to format.

Types

type FacetBucketFilter

type FacetBucketFilter struct{}

type FacetFilter

type FacetFilter struct {
	FieldName string        `json:"fieldName"`
	Values    []FilterValue `json:"values"`
}

type FacetFilterSet

type FacetFilterSet struct {
	Filters []FacetFilter `json:"filters"`
}

type FilterValue

type FilterValue struct {
	Value        string `json:"value"`
	RelationType string `json:"relationType"`
}

type Options

type Options struct {
	InputDetails      *SearchInputDetails `json:"inputDetails,omitempty"`
	SessionInfo       *SessionInfo        `json:"sessionInfo,omitempty"`
	RequestOptions    *RequestOptions     `json:"requestOptions,omitempty"`
	Query             string              `json:"query"`
	Cursor            string              `json:"cursor,omitempty"`
	Timestamp         string              `json:"timestamp,omitempty"`
	TrackingToken     string              `json:"trackingToken,omitempty"`
	ResultTabIds      []string            `json:"resultTabIds,omitempty"`
	PageSize          int                 `json:"pageSize,omitempty"`
	MaxSnippetSize    int                 `json:"maxSnippetSize,omitempty"`
	TimeoutMillis     int                 `json:"timeoutMillis,omitempty"`
	DisableSpellcheck bool                `json:"disableSpellcheck,omitempty"`
}

Options holds all CLI-level search options parsed from flags. These are mapped to the SDK's components.SearchRequest inside performSearch.

type RequestOptions

type RequestOptions struct {
	Exclusions                   *RestrictionFilters `json:"exclusions,omitempty"`
	FacetBucketFilter            *FacetBucketFilter  `json:"facetBucketFilter,omitempty"`
	Inclusions                   *RestrictionFilters `json:"inclusions,omitempty"`
	DatasourceFilter             string              `json:"datasourceFilter,omitempty"`
	FacetFilters                 []FacetFilter       `json:"facetFilters,omitempty"`
	FacetFilterSets              []FacetFilterSet    `json:"facetFilterSets,omitempty"`
	ResponseHints                []string            `json:"responseHints,omitempty"`
	DefaultFacets                []string            `json:"defaultFacets,omitempty"`
	DatasourcesFilter            []string            `json:"datasourcesFilter,omitempty"`
	FacetBucketSize              int                 `json:"facetBucketSize"`
	TimezoneOffset               int                 `json:"timezoneOffset,omitempty"`
	DisableQueryAutocorrect      bool                `json:"disableQueryAutocorrect,omitempty"`
	DisableSpellcheck            bool                `json:"disableSpellcheck,omitempty"`
	FetchAllDatasourceCounts     bool                `json:"fetchAllDatasourceCounts,omitempty"`
	QueryOverridesFacetFilters   bool                `json:"queryOverridesFacetFilters,omitempty"`
	ReturnLlmContentOverSnippets bool                `json:"returnLlmContentOverSnippets,omitempty"`
}

type RestrictionFilters

type RestrictionFilters struct{}

type SearchInputDetails

type SearchInputDetails struct {
	HasCopyPaste bool `json:"hasCopyPaste,omitempty"`
}

type SessionInfo

type SessionInfo struct {
	LastQuery            string `json:"lastQuery,omitempty"`
	LastSeen             string `json:"lastSeen,omitempty"`
	SessionTrackingToken string `json:"sessionTrackingToken,omitempty"`
	TabId                string `json:"tabId,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL