Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultFacetQuery = FacetQuery{FacetFields: map[string]FacetQueryOptions{}, /* contains filtered or unexported fields */}
var DefaultFacetQueryOptions = FacetQueryOptions{Size: 10}
var DefaultSearchOptions = Options{Page: 1, PageSize: 20}
Functions ¶
This section is empty.
Types ¶
type Facet ¶
type Facet struct { // Counts represent distinct field values and number of times they appear in a faceted field Counts []FacetCount Stats FacetStats }
Facet represents unique values with counts and aggregated summary of values in a faceted field
func (*Facet) From ¶
func (f *Facet) From(apiFacet *api.SearchFacet)
From constructs Facet from Tigris server's search response sets default values for missing/nil input
type FacetCount ¶
FacetCount represents number/ Count of times a Value appeared in the faceted field
func (*FacetCount) From ¶
func (f *FacetCount) From(apiFacetCount *api.FacetCount)
From constructs FacetCount from Tigris server's search response sets default values for missing/nil input
type FacetQuery ¶
type FacetQuery struct { FacetFields map[string]FacetQueryOptions // contains filtered or unexported fields }
type FacetQueryBuilder ¶
type FacetQueryBuilder interface { // WithFields would add fields to query with default query options WithFields(...string) FacetQueryBuilder WithFieldAndOption(string, FacetQueryOptions) FacetQueryBuilder WithFieldOptions(map[string]FacetQueryOptions) FacetQueryBuilder Build() *FacetQuery }
func NewFacetQueryBuilder ¶
func NewFacetQueryBuilder() FacetQueryBuilder
type FacetQueryOptions ¶
type FacetQueryOptions struct{ Size int }
type FacetStats ¶
type FacetStats struct { // Average of all values in a field. Only available for numeric fields Avg *float64 // Maximum of all values in a field. Only available for numeric fields Max *float64 // Minimum of all values in a field. Only available for numeric fields Min *float64 // Sum of all values in a field. Only available for numeric fields Sum *float64 // Total number of values in a field Count int64 }
FacetStats represent statistics for the faceted field
func (*FacetStats) From ¶
func (f *FacetStats) From(apiFacet *api.FacetStats)
From constructs FacetStats from Tigris server's search response sets default values for missing/nil input
type Hit ¶
type Hit[T schema.Model] struct { // Document represents the matched collection document unmarshalled into type T Document *T // Meta is the relevance metadata for this collection document Meta *HitMeta }
Hit represents a matched document for search query and relevant matching metadata
type HitMeta ¶
type HitMeta struct { // CreatedAt is the time at which document was inserted/replaced //Measured in nanoseconds since the UTC Unix epoch. CreatedAt *time.Time // UpdatedAt is the time at which document was inserted/replaced //Measured in nanoseconds since the UTC Unix epoch. UpdatedAt *time.Time }
HitMeta represents the metadata associated with a search hit
func (*HitMeta) From ¶
func (hm *HitMeta) From(apiHitMeta *api.SearchHitMeta)
From constructs HitMeta from Tigris server's response
type Meta ¶
type Meta struct { // Found represents total number of results matching the search query Found int64 // TotalPages represent the total number of pages of search results TotalPages int32 // Page represents pagination metadata for current page Page Page }
Meta represents search response metadata from server
func (*Meta) From ¶
func (m *Meta) From(apiMeta *api.SearchMetadata)
From constructs Meta from Tigris server's search response metadata sets default values for missing/nil input
type Page ¶
type Page struct { // Current page number for the paginated search results Current int32 // Size represents maximum number of search results displayed per page Size int32 }
Page includes pagination metadata for search results
type Request ¶
type Request struct { // Q is the text search query associated with this request Q string // Optional SearchFields is an array of fields to project Q against // if not specified, query will be projected against all searchable fields SearchFields []string // Optional Filter is applied on search results to further refine them Filter filter.Filter // Optional Facet query can be used to request categorical arrangement of the indexed terms Facet *FacetQuery // Optional Sort order can be specified to order the search results Sort *sort.Order // Optional IncludeFields sets the document fields to include in search results // By default, all documents fields will be included, unless ExcludeFields is specified IncludeFields []string // Optional ExcludeFields sets the document fields that shouldn't be included in results ExcludeFields []string // Optional Options provide pagination input Options *Options }
Request for search
type RequestBuilder ¶
type RequestBuilder interface { WithQuery(q string) RequestBuilder WithSearchFields(fields ...string) RequestBuilder WithFilter(filter.Filter) RequestBuilder WithFacetFields(fields ...string) RequestBuilder WithFacet(*FacetQuery) RequestBuilder WithSorting(sortByFields ...sort.Sort) RequestBuilder WithSortOrder(sortOrder sort.Order) RequestBuilder WithIncludeFields(fields ...string) RequestBuilder WithExcludeFields(fields ...string) RequestBuilder WithOptions(*Options) RequestBuilder Build() *Request }
func MatchAll ¶
func MatchAll() RequestBuilder
func NewRequestBuilder ¶
func NewRequestBuilder() RequestBuilder
Example ¶
req := NewRequestBuilder().WithQuery("my search text").Build() fmt.Println(req.Q)
Output: my search text
type Result ¶
type Result[T schema.Model] struct { // Hits is the results of the query as a list Hits []Hit[T] // Facets contain the facet distribution of any requested faceted fields Facets map[string]Facet // Meta represents metadata associated with this search result Meta Meta }
Result represents response to a search query