Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func Int(v int) *int
- func Int64(v int) *int64
- func String(v string) *string
- type AliasesService
- func (s *AliasesService) Delete(ctx context.Context, aliasName string) (*CollectionAlias, error)
- func (s *AliasesService) Get(ctx context.Context, aliasName string) (*CollectionAlias, error)
- func (s *AliasesService) List(ctx context.Context) ([]*CollectionAlias, error)
- func (s *AliasesService) Upsert(ctx context.Context, aliasName string, body *CollectionAliasSchema) (*CollectionAlias, error)
- type AnalyticsEvent
- type AnalyticsEventCreateResponse
- type AnalyticsEventsService
- type AnalyticsRule
- type AnalyticsRuleDeleteResponse
- type AnalyticsRuleListResponse
- type AnalyticsRuleParams
- type AnalyticsRuleType
- type AnalyticsRuleUpsertSchema
- type AnalyticsRulesService
- func (s *AnalyticsRulesService) Create(ctx context.Context, body *AnalyticsRule) (*AnalyticsRule, error)
- func (s *AnalyticsRulesService) Delete(ctx context.Context, ruleName string) (*AnalyticsRuleDeleteResponse, error)
- func (s *AnalyticsRulesService) Get(ctx context.Context, ruleName string) (*AnalyticsRule, error)
- func (s *AnalyticsRulesService) List(ctx context.Context) (*AnalyticsRuleListResponse, error)
- func (s *AnalyticsRulesService) Upsert(ctx context.Context, ruleName string, body *AnalyticsRuleUpsertSchema) (*AnalyticsRule, error)
- type ApiError
- type ApiKey
- type ApiKeySchema
- type ApiKeysResponse
- type ApiResponse
- type Client
- type Collection
- type CollectionAlias
- type CollectionAliasSchema
- type CollectionAliasesResponse
- type CollectionSchema
- type CollectionUpdateSchema
- type CollectionsService
- func (s *CollectionsService) Create(ctx context.Context, body *CollectionSchema) (*Collection, error)
- func (s *CollectionsService) Delete(ctx context.Context, collectionName string) (*Collection, error)
- func (s *CollectionsService) Get(ctx context.Context, collectionName string) (*Collection, error)
- func (s *CollectionsService) List(ctx context.Context) ([]*CollectionSchema, error)
- func (s *CollectionsService) Update(ctx context.Context, collectionName string, body *CollectionUpdateSchema) (*CollectionUpdateSchema, error)
- type Config
- type CreateCollectionJSONRequestBody
- type CreateKeyJSONRequestBody
- type Debug
- type DeleteByQueryResponse
- type DeleteDocumentsParams
- type DeleteOptions
- type DeleteOverrideResponse
- type DeleteRateLimitResponse
- type DeleteSynonymResponse
- type DirtyValuesOptions
- type DocumentsService
- func (s *DocumentsService) Create(ctx context.Context, collectionName string, body interface{}) (interface{}, error)
- func (s *DocumentsService) Delete(ctx context.Context, collectionName, documentId string) (interface{}, error)
- func (s *DocumentsService) DeleteByQuery(ctx context.Context, collectionName string, opts *DeleteOptions) (*DeleteByQueryResponse, error)
- func (s *DocumentsService) Export(ctx context.Context, collectionName string, opts *ExportDocumentsParams) ([]map[string]interface{}, error)
- func (s *DocumentsService) Get(ctx context.Context, collectionName, documentId string) (interface{}, error)
- func (s *DocumentsService) Import(ctx context.Context, collectionName string, body []map[string]interface{}, ...) ([]*ImportDocumentResponse, error)
- func (s *DocumentsService) MultiSearch(ctx context.Context, body *MultiSearchSearchesParameter, ...) (*MultiSearchResult, error)
- func (s *DocumentsService) Search(ctx context.Context, collectionName string, opts *SearchParameters) (*SearchResult, error)
- func (s *DocumentsService) Update(ctx context.Context, collectionName, documentId string, body interface{}) (interface{}, error)
- func (s *DocumentsService) UpdateByQuery(ctx context.Context, collectionName, body interface{}, opts *UpdateOptions) (*UpdateByQueryResponse, error)
- type ExportDocumentsParams
- type FacetCounts
- type Field
- type HealthStatus
- type ImportDocumentResponse
- type ImportDocumentsParams
- type ImportDocumentsParamsImportDocumentsParametersDirtyValues
- type IndexDocumentJSONBody
- type IndexDocumentJSONRequestBody
- type IndexDocumentParams
- type IndexDocumentParamsAction
- type KeysService
- func (s *KeysService) Create(ctx context.Context, body *ApiKeySchema) (*ApiKey, error)
- func (s *KeysService) Delete(ctx context.Context, keyId int) (*ApiKey, error)
- func (s *KeysService) Get(ctx context.Context, keyId int) (*ApiKey, error)
- func (s *KeysService) List(ctx context.Context) (*ApiKeysResponse, error)
- type MetaService
- func (s *MetaService) Config(ctx context.Context, body *Config) (*SuccessStatus, error)
- func (s *MetaService) Debug(ctx context.Context) (*Debug, error)
- func (s *MetaService) Health(ctx context.Context) (*HealthStatus, error)
- func (s *MetaService) Metrics(ctx context.Context) (*Metrics, error)
- func (s *MetaService) Stats(ctx context.Context) (*Stats, error)
- func (s *MetaService) Status(ctx context.Context) (*NodeStatus, error)
- type Metrics
- type MultiSearchCollectionParameters
- type MultiSearchJSONRequestBody
- type MultiSearchParameters
- type MultiSearchParams
- type MultiSearchResult
- type MultiSearchSearchesParameter
- type NodeStatus
- type OperationsService
- func (s *OperationsService) ClearCache(ctx context.Context) (*SuccessStatus, error)
- func (s *OperationsService) CompactDB(ctx context.Context) (*SuccessStatus, error)
- func (s *OperationsService) ResetPeers(ctx context.Context) (*SuccessStatus, error)
- func (s *OperationsService) Snapshot(ctx context.Context, opts *TakeSnapshotParams) (*SuccessStatus, error)
- func (s *OperationsService) Vote(ctx context.Context) (*SuccessStatus, error)
- type OverridesService
- func (s *OverridesService) Delete(ctx context.Context, collectionName, overrideId string) (*DeleteOverrideResponse, error)
- func (s *OverridesService) Get(ctx context.Context, collectionName, overrideId string) (*SearchOverride, error)
- func (s *OverridesService) List(ctx context.Context, collectionName string) (*SearchOverridesResponse, error)
- func (s *OverridesService) Upsert(ctx context.Context, collectionName, overrideId string, ...) (*SearchOverride, error)
- type Preset
- type PresetListResponse
- type PresetUpsertSchema
- type PresetsService
- func (s *PresetsService) Delete(ctx context.Context, presetName string) (*Preset, error)
- func (s *PresetsService) Get(ctx context.Context, presetName string) (*Preset, error)
- func (s *PresetsService) List(ctx context.Context) (*PresetListResponse, error)
- func (s *PresetsService) Upsert(ctx context.Context, presetName string, body *PresetUpsertSchema) (*Preset, error)
- type RateLimitAction
- type RateLimitExceed
- type RateLimitResponse
- type RateLimitRule
- type RateLimitRuleSchema
- type RateLimitStateType
- type RateLimitStatus
- type RateLimitsService
- func (s *RateLimitsService) Create(ctx context.Context, body *RateLimitRuleSchema) (*RateLimitResponse, error)
- func (s *RateLimitsService) Delete(ctx context.Context, id int) (*DeleteRateLimitResponse, error)
- func (s *RateLimitsService) DeleteActive(ctx context.Context, id int) (*DeleteRateLimitResponse, error)
- func (s *RateLimitsService) DeleteExceeds(ctx context.Context, id int) (*DeleteRateLimitResponse, error)
- func (s *RateLimitsService) Get(ctx context.Context, id int) (*RateLimitRule, error)
- func (s *RateLimitsService) List(ctx context.Context) ([]*RateLimitRule, error)
- func (s *RateLimitsService) ListActive(ctx context.Context) ([]*RateLimitStatus, error)
- func (s *RateLimitsService) ListExceeds(ctx context.Context) ([]*RateLimitExceed, error)
- func (s *RateLimitsService) Update(ctx context.Context, id int, body *RateLimitRuleSchema) (*RateLimitResponse, error)
- type RequestOption
- type ResultOrError
- type SearchCollectionParams
- type SearchError
- type SearchGroupedHit
- type SearchHighlight
- type SearchOverride
- type SearchOverrideExclude
- type SearchOverrideInclude
- type SearchOverrideRule
- type SearchOverrideRuleMatch
- type SearchOverrideSchema
- type SearchOverridesResponse
- type SearchParameters
- type SearchResult
- type SearchResultHit
- type SearchSynonym
- type SearchSynonymSchema
- type SearchSynonymsResponse
- type Stats
- type SuccessStatus
- type SynonymsService
- func (s *SynonymsService) Delete(ctx context.Context, collectionName, synonymId string) (*DeleteSynonymResponse, error)
- func (s *SynonymsService) Get(ctx context.Context, collectionName, synonymId string) (*SearchSynonym, error)
- func (s *SynonymsService) List(ctx context.Context, collectionName string) (*SearchSynonymsResponse, error)
- func (s *SynonymsService) Upsert(ctx context.Context, collectionName, synonymId string, ...) (*SearchSynonym, error)
- type TakeSnapshotParams
- type UpdateByQueryResponse
- type UpdateCollectionJSONRequestBody
- type UpdateDocumentJSONBody
- type UpdateDocumentJSONRequestBody
- type UpdateDocumentsJSONBody
- type UpdateDocumentsJSONRequestBody
- type UpdateDocumentsParams
- type UpdateOptions
- type UpsertAliasJSONRequestBody
- type UpsertSearchOverrideJSONRequestBody
- type UpsertSearchSynonymJSONRequestBody
Constants ¶
const (
Api_key_headerScopes = "api_key_header.Scopes"
)
const (
Version = "v0.25.0" // typesense server version
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AliasesService ¶
type AliasesService service
func (*AliasesService) Delete ¶
func (s *AliasesService) Delete(ctx context.Context, aliasName string) (*CollectionAlias, error)
func (*AliasesService) Get ¶
func (s *AliasesService) Get(ctx context.Context, aliasName string) (*CollectionAlias, error)
func (*AliasesService) List ¶
func (s *AliasesService) List(ctx context.Context) ([]*CollectionAlias, error)
func (*AliasesService) Upsert ¶
func (s *AliasesService) Upsert(ctx context.Context, aliasName string, body *CollectionAliasSchema) (*CollectionAlias, error)
type AnalyticsEvent ¶
type AnalyticsEventCreateResponse ¶
type AnalyticsEventCreateResponse struct {
OK bool `json:"ok"`
}
type AnalyticsEventsService ¶
type AnalyticsEventsService service
func (*AnalyticsEventsService) Create ¶
func (s *AnalyticsEventsService) Create(ctx context.Context, body *AnalyticsEvent) (*AnalyticsEventCreateResponse, error)
type AnalyticsRule ¶
type AnalyticsRule struct { Name string `json:"name"` Type AnalyticsRuleType `json:"type"` // only "popular_queries" is supported Params AnalyticsRuleParams `json:"params"` }
type AnalyticsRuleDeleteResponse ¶
type AnalyticsRuleDeleteResponse struct {
Name string `json:"name"`
}
type AnalyticsRuleListResponse ¶
type AnalyticsRuleListResponse struct {
Rules []*AnalyticsRule `json:"rules"`
}
type AnalyticsRuleParams ¶
type AnalyticsRuleType ¶
type AnalyticsRuleType string
const (
POPULAR_QUERIES_TYPE AnalyticsRuleType = "popular_queries"
)
type AnalyticsRuleUpsertSchema ¶
type AnalyticsRuleUpsertSchema struct { Type AnalyticsRuleType `json:"type"` // only "popular_queries" is supported Params struct { Source struct { Collections []string `json:"collections"` } `json:"source"` Destination struct { Collection string `json:"collection"` } `json:"destination"` Limit int `json:"limit"` } `json:"params"` }
type AnalyticsRulesService ¶
type AnalyticsRulesService service
func (*AnalyticsRulesService) Create ¶
func (s *AnalyticsRulesService) Create(ctx context.Context, body *AnalyticsRule) (*AnalyticsRule, error)
func (*AnalyticsRulesService) Delete ¶
func (s *AnalyticsRulesService) Delete(ctx context.Context, ruleName string) (*AnalyticsRuleDeleteResponse, error)
func (*AnalyticsRulesService) Get ¶
func (s *AnalyticsRulesService) Get(ctx context.Context, ruleName string) (*AnalyticsRule, error)
func (*AnalyticsRulesService) List ¶
func (s *AnalyticsRulesService) List(ctx context.Context) (*AnalyticsRuleListResponse, error)
func (*AnalyticsRulesService) Upsert ¶
func (s *AnalyticsRulesService) Upsert(ctx context.Context, ruleName string, body *AnalyticsRuleUpsertSchema) (*AnalyticsRule, error)
type ApiError ¶
type ApiError struct { Response *http.Response `json:"-"` StatusCode int `json:"status_code"` Body ApiResponse `json:"body"` }
type ApiKey ¶
type ApiKey struct { Actions []string `json:"actions"` Collections []string `json:"collections"` Description string `json:"description"` ExpiresAt *int64 `json:"expires_at,omitempty"` Id *int64 `json:"id,omitempty"` Value *string `json:"value,omitempty"` ValuePrefix *string `json:"value_prefix,omitempty"` }
ApiKey defines model for ApiKey.
type ApiKeySchema ¶
type ApiKeySchema struct { Actions []string `json:"actions"` Collections []string `json:"collections"` Description *string `json:"description"` ExpiresAt *int64 `json:"expires_at,omitempty"` Value *string `json:"value,omitempty"` }
ApiKeySchema defines model for ApiKeySchema.
type ApiKeysResponse ¶
type ApiKeysResponse struct {
Keys []*ApiKey `json:"keys"`
}
ApiKeysResponse defines model for ApiKeysResponse.
type ApiResponse ¶
type ApiResponse struct {
Message string `json:"message"`
}
ApiResponse defines model for ApiResponse.
type Client ¶
type Client struct { ServerURL *url.URL Collections *CollectionsService Documents *DocumentsService Keys *KeysService RateLimits *RateLimitsService Operations *OperationsService Meta *MetaService Overrides *OverridesService Aliases *AliasesService AnalyticsRules *AnalyticsRulesService AnalyticsEvents *AnalyticsEventsService Presets *PresetsService Synonyms *SynonymsService // contains filtered or unexported fields }
func (*Client) NewRequest ¶
func (*Client) WithAPIKey ¶
type Collection ¶
type Collection struct { // CreatedAt Timestamp of when the collection was created (Unix epoch in // seconds) CreatedAt *int64 `json:"created_at,omitempty"` // DefaultSortingField The name of an int32 / float field that determines // the order in which the search results are ranked when a sort_by clause is // not provided during searching. This field must indicate some kind of // popularity. DefaultSortingField *string `json:"default_sorting_field,omitempty"` // EnableNestedFields Enables experimental support at a collection level for // nested object or object array fields. This field is only available if the // Typesense server is version `0.24.0.rcn34` or later. EnableNestedFields *bool `json:"enable_nested_fields,omitempty"` // Fields A list of fields for querying, filtering and faceting Fields []*Field `json:"fields"` // Name Name of the collection Name string `json:"name"` // NumDocuments Number of documents in the collection NumDocuments *int64 `json:"num_documents,omitempty"` // SymbolsToIndex List of symbols or special characters to be indexed. SymbolsToIndex []string `json:"symbols_to_index,omitempty"` // TokenSeparators List of symbols or special characters to be used for // splitting the text into individual words in addition to space and // new-line characters. TokenSeparators []string `json:"token_separators,omitempty"` }
Collection defines model for Collection.
type CollectionAlias ¶
type CollectionAlias struct { // CollectionName Name of the collection the alias mapped to CollectionName string `json:"collection_name"` // Name Name of the collection alias Name string `json:"name"` }
CollectionAlias defines model for CollectionAlias.
type CollectionAliasSchema ¶
type CollectionAliasSchema struct { // CollectionName Name of the collection you wish to map the alias to CollectionName string `json:"collection_name"` }
CollectionAliasSchema defines model for CollectionAliasSchema.
type CollectionAliasesResponse ¶
type CollectionAliasesResponse struct {
Aliases []*CollectionAlias `json:"aliases"`
}
CollectionAliasesResponse defines model for CollectionAliasesResponse.
type CollectionSchema ¶
type CollectionSchema struct { // DefaultSortingField The name of an int32 / float field that determines // the order in which the search results are ranked when a sort_by clause is // not provided during searching. This field must indicate some kind of // popularity. DefaultSortingField *string `json:"default_sorting_field,omitempty"` // EnableNestedFields Enables experimental support at a collection level for // nested object or object array fields. This field is only available if the // Typesense server is version `0.24.0.rcn34` or later. EnableNestedFields *bool `json:"enable_nested_fields,omitempty"` // Fields A list of fields for querying, filtering and faceting Fields []*Field `json:"fields"` // Name Name of the collection Name string `json:"name"` // SymbolsToIndex List of symbols or special characters to be indexed. SymbolsToIndex []string `json:"symbols_to_index,omitempty"` // TokenSeparators List of symbols or special characters to be used for // splitting the text into individual words in addition to space and // new-line characters. TokenSeparators []string `json:"token_separators,omitempty"` }
CollectionSchema defines model for CollectionSchema.
type CollectionUpdateSchema ¶
type CollectionUpdateSchema struct { // Fields A list of fields for querying, filtering and faceting Fields []*Field `json:"fields"` }
CollectionUpdateSchema defines model for CollectionUpdateSchema.
type CollectionsService ¶
type CollectionsService service
func (*CollectionsService) Create ¶
func (s *CollectionsService) Create(ctx context.Context, body *CollectionSchema) (*Collection, error)
func (*CollectionsService) Delete ¶
func (s *CollectionsService) Delete(ctx context.Context, collectionName string) (*Collection, error)
func (*CollectionsService) Get ¶
func (s *CollectionsService) Get(ctx context.Context, collectionName string) (*Collection, error)
func (*CollectionsService) List ¶
func (s *CollectionsService) List(ctx context.Context) ([]*CollectionSchema, error)
func (*CollectionsService) Update ¶
func (s *CollectionsService) Update(ctx context.Context, collectionName string, body *CollectionUpdateSchema) (*CollectionUpdateSchema, error)
type CreateCollectionJSONRequestBody ¶
type CreateCollectionJSONRequestBody = CollectionSchema
CreateCollectionJSONRequestBody defines body for CreateCollection for application/json ContentType.
type CreateKeyJSONRequestBody ¶
type CreateKeyJSONRequestBody = ApiKeySchema
CreateKeyJSONRequestBody defines body for CreateKey for application/json ContentType.
type DeleteByQueryResponse ¶
type DeleteByQueryResponse struct {
NumDeleted *int `json:"num_deleted"`
}
type DeleteDocumentsParams ¶
type DeleteDocumentsParams struct { DeleteDocumentsParameters *struct { // BatchSize Batch size parameter controls the number of documents that // should be deleted at a time. A larger value will speed up deletions, // but will impact performance of other operations running on the // server. BatchSize *int `json:"batch_size,omitempty"` FilterBy *string `json:"filter_by,omitempty"` } `form:"deleteDocumentsParameters,omitempty" json:"deleteDocumentsParameters,omitempty"` }
DeleteDocumentsParams defines parameters for DeleteDocuments.
type DeleteOptions ¶
type DeleteOverrideResponse ¶
type DeleteOverrideResponse struct {
ID string `json:"id"`
}
type DeleteRateLimitResponse ¶
type DeleteRateLimitResponse struct {
ID int `json:"id"`
}
type DeleteSynonymResponse ¶
type DeleteSynonymResponse struct {
ID string `json:"id"`
}
type DirtyValuesOptions ¶
type DirtyValuesOptions string
const ( CoerceOrDrop DirtyValuesOptions = "coerce_or_drop" CoerceOrReject DirtyValuesOptions = "coerce_or_reject" Drop DirtyValuesOptions = "drop" Reject DirtyValuesOptions = "reject" )
type DocumentsService ¶
type DocumentsService service
func (*DocumentsService) Create ¶
func (s *DocumentsService) Create(ctx context.Context, collectionName string, body interface{}) (interface{}, error)
func (*DocumentsService) Delete ¶
func (s *DocumentsService) Delete(ctx context.Context, collectionName, documentId string) (interface{}, error)
func (*DocumentsService) DeleteByQuery ¶
func (s *DocumentsService) DeleteByQuery(ctx context.Context, collectionName string, opts *DeleteOptions) (*DeleteByQueryResponse, error)
func (*DocumentsService) Export ¶
func (s *DocumentsService) Export(ctx context.Context, collectionName string, opts *ExportDocumentsParams) ([]map[string]interface{}, error)
TODO: handle jsonl
func (*DocumentsService) Get ¶
func (s *DocumentsService) Get(ctx context.Context, collectionName, documentId string) (interface{}, error)
func (*DocumentsService) Import ¶
func (s *DocumentsService) Import(ctx context.Context, collectionName string, body []map[string]interface{}, opts *ImportDocumentsParams) ([]*ImportDocumentResponse, error)
TODO: handle jsonl
func (*DocumentsService) MultiSearch ¶
func (s *DocumentsService) MultiSearch(ctx context.Context, body *MultiSearchSearchesParameter, opts *MultiSearchParameters) (*MultiSearchResult, error)
func (*DocumentsService) Search ¶
func (s *DocumentsService) Search(ctx context.Context, collectionName string, opts *SearchParameters) (*SearchResult, error)
func (*DocumentsService) Update ¶
func (s *DocumentsService) Update(ctx context.Context, collectionName, documentId string, body interface{}) (interface{}, error)
func (*DocumentsService) UpdateByQuery ¶
func (s *DocumentsService) UpdateByQuery(ctx context.Context, collectionName, body interface{}, opts *UpdateOptions) (*UpdateByQueryResponse, error)
type ExportDocumentsParams ¶
type ExportDocumentsParams struct { // ExcludeFields List of fields from the document to exclude in the search result ExcludeFields string `url:"exclude_fields,omitempty"` // FilterBy Filter conditions for refining your search results. Separate multiple conditions with &&. FilterBy string `url:"filter_by,omitempty"` // IncludeFields List of fields from the document to include in the search result IncludeFields string `url:"include_fields,omitempty"` }
ExportDocumentsParams defines parameters for ExportDocuments.
type FacetCounts ¶
type FacetCounts struct { Counts *[]struct { Count *int `json:"count,omitempty"` Highlighted *string `json:"highlighted,omitempty"` Value *string `json:"value,omitempty"` } `json:"counts,omitempty"` FieldName *string `json:"field_name,omitempty"` Stats *struct { Avg *float64 `json:"avg,omitempty"` Max *float64 `json:"max,omitempty"` Min *float64 `json:"min,omitempty"` Sum *float64 `json:"sum,omitempty"` TotalValues *int `json:"total_values,omitempty"` } `json:"stats,omitempty"` }
FacetCounts defines model for FacetCounts.
type Field ¶
type Field struct { Drop *bool `json:"drop,omitempty"` Embed *struct { From []string `json:"from"` ModelConfig *struct { AccessToken *string `json:"access_token,omitempty"` ApiKey *string `json:"api_key,omitempty"` ClientId *string `json:"client_id,omitempty"` ClientSecret *string `json:"client_secret,omitempty"` ModelName *string `json:"model_name"` ProjectId *string `json:"project_id,omitempty"` } `json:"model_config"` } `json:"embed,omitempty"` Facet *bool `json:"facet,omitempty"` Index *bool `json:"index,omitempty"` Infix *bool `json:"infix,omitempty"` Locale *string `json:"locale,omitempty"` Name string `json:"name"` NumDim *int `json:"num_dim,omitempty"` Optional *bool `json:"optional,omitempty"` Sort *bool `json:"sort,omitempty"` Type string `json:"type"` }
Field defines model for Field.
type HealthStatus ¶
type HealthStatus struct {
Ok bool `json:"ok"`
}
HealthStatus defines model for HealthStatus.
type ImportDocumentResponse ¶
type ImportDocumentsParams ¶
type ImportDocumentsParamsImportDocumentsParametersDirtyValues ¶
type ImportDocumentsParamsImportDocumentsParametersDirtyValues string
ImportDocumentsParamsImportDocumentsParametersDirtyValues defines parameters for ImportDocuments.
type IndexDocumentJSONBody ¶
type IndexDocumentJSONBody = interface{}
IndexDocumentJSONBody defines parameters for IndexDocument.
type IndexDocumentJSONRequestBody ¶
type IndexDocumentJSONRequestBody = IndexDocumentJSONBody
IndexDocumentJSONRequestBody defines body for IndexDocument for application/json ContentType.
type IndexDocumentParams ¶
type IndexDocumentParams struct { // Action Additional action to perform Action *IndexDocumentParamsAction `form:"action,omitempty" json:"action,omitempty"` }
IndexDocumentParams defines parameters for IndexDocument.
type IndexDocumentParamsAction ¶
type IndexDocumentParamsAction string
IndexDocumentParamsAction defines parameters for IndexDocument.
const (
Upsert IndexDocumentParamsAction = "upsert"
)
Defines values for IndexDocumentParamsAction.
type KeysService ¶
type KeysService service
func (*KeysService) Create ¶
func (s *KeysService) Create(ctx context.Context, body *ApiKeySchema) (*ApiKey, error)
func (*KeysService) List ¶
func (s *KeysService) List(ctx context.Context) (*ApiKeysResponse, error)
type MetaService ¶
type MetaService service
func (*MetaService) Config ¶
func (s *MetaService) Config(ctx context.Context, body *Config) (*SuccessStatus, error)
func (*MetaService) Health ¶
func (s *MetaService) Health(ctx context.Context) (*HealthStatus, error)
func (*MetaService) Status ¶
func (s *MetaService) Status(ctx context.Context) (*NodeStatus, error)
type Metrics ¶
type Metrics struct { SystemCPUActivePercentage string `json:"system_cpu_active_percentage"` SystemCPUIndividualPercentage map[string]string `json:"-"` SystemDiskTotalBytes string `json:"system_disk_total_bytes"` SystemDiskUsedBytes string `json:"system_disk_used_bytes"` SystemMemoryTotalBytes string `json:"system_memory_total_bytes"` SystemMemoryUsedBytes string `json:"system_memory_used_bytes"` SystemNetworkReceivedBytes string `json:"system_network_received_bytes"` SystemNetworkSentBytes string `json:"system_network_sent_bytes"` TypesenseMemoryActiveBytes string `json:"typesense_memory_active_bytes"` TypesenseMemoryAllocatedBytes string `json:"typesense_memory_allocated_bytes"` TypesenseMemoryFragmentationRatio string `json:"typesense_memory_fragmentation_ratio"` TypesenseMemoryMappedBytes string `json:"typesense_memory_mapped_bytes"` TypesenseMemoryMetadataBytes string `json:"typesense_memory_metadata_bytes"` TypesenseMemoryResidentBytes string `json:"typesense_memory_resident_bytes"` TypesenseMemoryRetainedBytes string `json:"typesense_memory_retained_bytes"` }
type MultiSearchCollectionParameters ¶
type MultiSearchCollectionParameters struct { // CacheTtl The duration (in seconds) that determines how long the search // query is cached. This value can be set on a per-query basis. Default: // 60. CacheTtl *int `json:"cache_ttl,omitempty"` // Collection The collection to search in. Collection string `json:"collection"` // DropTokensThreshold If the number of results found for a specific query // is less than this number, Typesense will attempt to drop the tokens in // the query until enough results are found. Tokens that have the least // individual hits are dropped first. Set to 0 to disable. Default: 10 DropTokensThreshold *int `json:"drop_tokens_threshold,omitempty"` // EnableOverrides If you have some overrides defined but want to disable // all of them during query time, you can do that by setting this parameter // to false EnableOverrides *bool `json:"enable_overrides,omitempty"` // ExcludeFields List of fields from the document to exclude in the search // result ExcludeFields *string `json:"exclude_fields,omitempty"` // ExhaustiveSearch Setting this to true will make Typesense consider all // prefixes and typo corrections of the words in the query without stopping // early when enough results are found (drop_tokens_threshold and // typo_tokens_threshold configurations are ignored). ExhaustiveSearch *bool `json:"exhaustive_search,omitempty"` // FacetBy A list of fields that will be used for faceting your results on. // Separate multiple fields with a comma. FacetBy *string `json:"facet_by,omitempty"` // FacetQuery Facet values that are returned can now be filtered via this // parameter. The matching facet text is also highlighted. For example, when // faceting by `category`, you can set `facet_query=category:shoe` to return // only facet values that contain the prefix "shoe". FacetQuery *string `json:"facet_query,omitempty"` // FilterBy Filter conditions for refining youropen api validator search // results. Separate multiple conditions with &&. FilterBy *string `json:"filter_by,omitempty"` // GroupBy You can aggregate search results into groups or buckets by // specify one or more `group_by` fields. Separate multiple fields with a // comma. To group on a particular field, it must be a faceted field. GroupBy *string `json:"group_by,omitempty"` // GroupLimit Maximum number of hits to be returned for every group. If the // `group_limit` is set as `K` then only the top K hits in each group are // returned in the response. Default: 3 GroupLimit *int `json:"group_limit,omitempty"` // HiddenHits A list of records to unconditionally hide from search results. // A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, // you'd specify `123,456`. You could also use the Overrides feature to // override search results based on rules. Overrides are applied first, // followed by `pinned_hits` and finally `hidden_hits`. HiddenHits *string `json:"hidden_hits,omitempty"` // HighlightAffixNumTokens The number of tokens that should surround the // highlighted text on each side. Default: 4 HighlightAffixNumTokens *int `json:"highlight_affix_num_tokens,omitempty"` // HighlightEndTag The end tag used for the highlighted snippets. Default: // `</mark>` HighlightEndTag *string `json:"highlight_end_tag,omitempty"` // HighlightFields A list of custom fields that must be highlighted even if // you don't query for them HighlightFields *string `json:"highlight_fields,omitempty"` // HighlightFullFields List of fields which should be highlighted fully // without snippeting HighlightFullFields *string `json:"highlight_full_fields,omitempty"` // HighlightStartTag The start tag used for the highlighted snippets. // Default: `<mark>` HighlightStartTag *string `json:"highlight_start_tag,omitempty"` // IncludeFields List of fields from the document to include in the search // result IncludeFields *string `json:"include_fields,omitempty"` // Infix If infix index is enabled for this field, infix searching can be // done on a per-field basis by sending a comma separated string parameter // called infix to the search query. This parameter can have 3 values; `off` // infix search is disabled, which is default `always` infix search is // performed along with regular search `fallback` infix search is performed // if regular search does not produce results Infix *string `json:"infix,omitempty"` // MaxExtraPrefix There are also 2 parameters that allow you to control the // extent of infix searching max_extra_prefix and max_extra_suffix which // specify the maximum number of symbols before or after the query that can // be present in the token. For example query "K2100" has 2 extra symbols in // "6PK2100". By default, any number of prefixes/suffixes can be present for // a match. MaxExtraPrefix *int `json:"max_extra_prefix,omitempty"` // MaxExtraSuffix There are also 2 parameters that allow you to control the // extent of infix searching max_extra_prefix and max_extra_suffix which // specify the maximum number of symbols before or after the query that can // be present in the token. For example query "K2100" has 2 extra symbols in // "6PK2100". By default, any number of prefixes/suffixes can be present for // a match. MaxExtraSuffix *int `json:"max_extra_suffix,omitempty"` // MaxFacetValues Maximum number of facet values to be returned. MaxFacetValues *int `json:"max_facet_values,omitempty"` // MinLen1typo Minimum word length for 1-typo correction to be applied. The // value of num_typos is still treated as the maximum allowed typos. MinLen1typo *int `json:"min_len_1typo,omitempty"` // MinLen2typo Minimum word length for 2-typo correction to be applied. The // value of num_typos is still treated as the maximum allowed typos. MinLen2typo *int `json:"min_len_2typo,omitempty"` // NumTypos The number of typographical errors (1 or 2) that would be // tolerated. Default: 2 NumTypos *string `json:"num_typos,omitempty"` // Page Results from this specific page number would be fetched. Page *int `json:"page,omitempty"` // PerPage Number of results to fetch per page. Default: 10 PerPage *int `json:"per_page,omitempty"` // PinnedHits A list of records to unconditionally include in the search // results at specific positions. An example use case would be to feature or // promote certain items on the top of search results. A list of // `record_id:hit_position`. Eg: to include a record with ID 123 at Position // 1 and another record with ID 456 at Position 5, you'd specify // `123:1,456:5`. You could also use the Overrides feature to override // search results based on rules. Overrides are applied first, followed by // `pinned_hits` and finally `hidden_hits`. PinnedHits *string `json:"pinned_hits,omitempty"` // PreSegmentedQuery You can index content from any logographic language // into Typesense if you are able to segment / split the text into // space-separated words yourself before indexing and querying. // Set this parameter to true to do the same PreSegmentedQuery *bool `json:"pre_segmented_query,omitempty"` // Prefix Boolean field to indicate that the last word in the query should // be treated as a prefix, and not as a whole word. This is used for // building autocomplete and instant search interfaces. Defaults to true. Prefix *string `json:"prefix,omitempty"` // Preset Search using a bunch of search parameters by setting this // parameter to the name of the existing Preset. Preset *string `json:"preset,omitempty"` // PrioritizeExactMatch Set this parameter to true to ensure that an exact // match is ranked above the others PrioritizeExactMatch *bool `json:"prioritize_exact_match,omitempty"` // Q The query text to search for in the collection. Use * as the search // string to return all documents. This is typically useful when used in // conjunction with filter_by. Q *string `json:"q,omitempty"` // QueryBy A list of `string` fields that should be queried against. // Multiple fields are separated with a comma. QueryBy *string `json:"query_by,omitempty"` // QueryByWeights The relative weight to give each `query_by` field when // ranking results. This can be used to boost fields in priority, when // looking for matches. Multiple fields are separated with a comma. QueryByWeights *string `json:"query_by_weights,omitempty"` // RemoteEmbeddingNumTries Number of times to retry fetching remote // embeddings. RemoteEmbeddingNumTries *int `json:"remote_embedding_num_tries,omitempty"` // RemoteEmbeddingTimeoutMs Timeout (in milliseconds) for fetching remote // embeddings. RemoteEmbeddingTimeoutMs *int `json:"remote_embedding_timeout_ms,omitempty"` // SearchCutoffMs Typesense will attempt to return results early if the // cutoff time has elapsed. This is not a strict guarantee and facet // computation is not bound by this parameter. SearchCutoffMs *int `json:"search_cutoff_ms,omitempty"` // SnippetThreshold Field values under this length will be fully // highlighted, instead of showing a snippet of relevant portion. Default: // 30 SnippetThreshold *int `json:"snippet_threshold,omitempty"` // SortBy A list of numerical fields and their corresponding sort orders // that will be used for ordering your results. Up to 3 sort fields can be // specified. The text similarity score is exposed as a special // `_text_match` field that you can use in the list of sorting fields. If no // `sort_by` parameter is specified, results are sorted by // `_text_match:desc,default_sorting_field:desc` SortBy *string `json:"sort_by,omitempty"` // TypoTokensThreshold If the number of results found for a specific query // is less than this number, Typesense will attempt to look for tokens with // more typos until enough results are found. Default: 100 TypoTokensThreshold *int `json:"typo_tokens_threshold,omitempty"` // UseCache Enable server side caching of search query results. By default, // caching is disabled. UseCache *bool `json:"use_cache,omitempty"` // VectorQuery Vector query expression for fetching documents "closest" to a // given query/document vector. VectorQuery *string `json:"vector_query,omitempty"` }
MultiSearchCollectionParameters defines model for MultiSearchCollectionParameters.
type MultiSearchJSONRequestBody ¶
type MultiSearchJSONRequestBody = MultiSearchSearchesParameter
MultiSearchJSONRequestBody defines body for MultiSearch for application/json ContentType.
type MultiSearchParameters ¶
type MultiSearchParameters struct { // CacheTtl The duration (in seconds) that determines how long the search // query is cached. This value can be set on a per-query basis. Default: // 60. CacheTtl *int `json:"cache_ttl,omitempty"` // DropTokensThreshold If the number of results found for a specific query // is less than this number, Typesense will attempt to drop the tokens in // the query until enough results are found. Tokens that have the least // individual hits are dropped first. Set to 0 to disable. Default: 10 DropTokensThreshold *int `json:"drop_tokens_threshold,omitempty"` // EnableOverrides If you have some overrides defined but want to disable // all of them during query time, you can do that by setting this parameter // to false EnableOverrides *bool `json:"enable_overrides,omitempty"` // ExcludeFields List of fields from the document to exclude in the search // result ExcludeFields *string `json:"exclude_fields,omitempty"` // ExhaustiveSearch Setting this to true will make Typesense consider all // prefixes and typo corrections of the words in the query without stopping // early when enough results are found (drop_tokens_threshold and // typo_tokens_threshold configurations are ignored). ExhaustiveSearch *bool `json:"exhaustive_search,omitempty"` // FacetBy A list of fields that will be used for faceting your results on. // Separate multiple fields with a comma. FacetBy *string `json:"facet_by,omitempty"` // FacetQuery Facet values that are returned can now be filtered via this // parameter. The matching facet text is also highlighted. For example, when // faceting by `category`, you can set `facet_query=category:shoe` to return // only facet values that contain the prefix "shoe". FacetQuery *string `json:"facet_query,omitempty"` // FilterBy Filter conditions for refining youropen api validator search // results. Separate multiple conditions with &&. FilterBy *string `json:"filter_by,omitempty"` // GroupBy You can aggregate search results into groups or buckets by // specify one or more `group_by` fields. Separate multiple fields with a // comma. To group on a particular field, it must be a faceted field. GroupBy *string `json:"group_by,omitempty"` // GroupLimit Maximum number of hits to be returned for every group. If the // `group_limit` is set as `K` then only the top K hits in each group are // returned in the response. Default: 3 GroupLimit *int `json:"group_limit,omitempty"` // HiddenHits A list of records to unconditionally hide from search results. // A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, // you'd specify `123,456`. You could also use the Overrides feature to // override search results based on rules. Overrides are applied first, // followed by `pinned_hits` and finally `hidden_hits`. HiddenHits *string `json:"hidden_hits,omitempty"` // HighlightAffixNumTokens The number of tokens that should surround the // highlighted text on each side. Default: 4 HighlightAffixNumTokens *int `json:"highlight_affix_num_tokens,omitempty"` // HighlightEndTag The end tag used for the highlighted snippets. Default: // `</mark>` HighlightEndTag *string `json:"highlight_end_tag,omitempty"` // HighlightFields A list of custom fields that must be highlighted even if // you don't query for them HighlightFields *string `json:"highlight_fields,omitempty"` // HighlightFullFields List of fields which should be highlighted fully // without snippeting HighlightFullFields *string `json:"highlight_full_fields,omitempty"` // HighlightStartTag The start tag used for the highlighted snippets. // Default: `<mark>` HighlightStartTag *string `json:"highlight_start_tag,omitempty"` // IncludeFields List of fields from the document to include in the search // result IncludeFields *string `json:"include_fields,omitempty"` // Infix If infix index is enabled for this field, infix searching can be // done on a per-field basis by sending a comma separated string parameter // called infix to the search query. This parameter can have 3 values; `off` // infix search is disabled, which is default `always` infix search is // performed along with regular search `fallback` infix search is performed // if regular search does not produce results Infix *string `json:"infix,omitempty"` // MaxExtraPrefix There are also 2 parameters that allow you to control the // extent of infix searching max_extra_prefix and max_extra_suffix which // specify the maximum number of symbols before or after the query that can // be present in the token. For example query "K2100" has 2 extra symbols in // "6PK2100". By default, any number of prefixes/suffixes can be present for // a match. MaxExtraPrefix *int `json:"max_extra_prefix,omitempty"` // MaxExtraSuffix There are also 2 parameters that allow you to control the // extent of infix searching max_extra_prefix and max_extra_suffix which // specify the maximum number of symbols before or after the query that can // be present in the token. For example query "K2100" has 2 extra symbols in // "6PK2100". By default, any number of prefixes/suffixes can be present for // a match. MaxExtraSuffix *int `json:"max_extra_suffix,omitempty"` // MaxFacetValues Maximum number of facet values to be returned. MaxFacetValues *int `json:"max_facet_values,omitempty"` // MinLen1typo Minimum word length for 1-typo correction to be applied. The // value of num_typos is still treated as the maximum allowed typos. MinLen1typo *int `json:"min_len_1typo,omitempty"` // MinLen2typo Minimum word length for 2-typo correction to be applied. The // value of num_typos is still treated as the maximum allowed typos. MinLen2typo *int `json:"min_len_2typo,omitempty"` // NumTypos The number of typographical errors (1 or 2) that would be // tolerated. Default: 2 NumTypos *string `json:"num_typos,omitempty"` // Page Results from this specific page number would be fetched. Page *int `json:"page,omitempty"` // PerPage Number of results to fetch per page. Default: 10 PerPage *int `json:"per_page,omitempty"` // PinnedHits A list of records to unconditionally include in the search // results at specific positions. An example use case would be to feature or // promote certain items on the top of search results. A list of // `record_id:hit_position`. Eg: to include a record with ID 123 at Position // 1 and another record with ID 456 at Position 5, you'd specify // `123:1,456:5`. You could also use the Overrides feature to override // search results based on rules. Overrides are applied first, followed by // `pinned_hits` and finally `hidden_hits`. PinnedHits *string `json:"pinned_hits,omitempty"` // PreSegmentedQuery You can index content from any logographic language // into Typesense if you are able to segment / split the text into // space-separated words yourself before indexing and querying. // Set this parameter to true to do the same PreSegmentedQuery *bool `json:"pre_segmented_query,omitempty"` // Prefix Boolean field to indicate that the last word in the query should // be treated as a prefix, and not as a whole word. This is used for // building autocomplete and instant search interfaces. Defaults to true. Prefix *string `json:"prefix,omitempty"` // Preset Search using a bunch of search parameters by setting this // parameter to the name of the existing Preset. Preset *string `json:"preset,omitempty"` // PrioritizeExactMatch Set this parameter to true to ensure that an exact // match is ranked above the others PrioritizeExactMatch *bool `json:"prioritize_exact_match,omitempty"` // Q The query text to search for in the collection. Use * as the search // string to return all documents. This is typically useful when used in // conjunction with filter_by. Q *string `json:"q,omitempty"` // QueryBy A list of `string` fields that should be queried against. // Multiple fields are separated with a comma. QueryBy *string `json:"query_by,omitempty"` // QueryByWeights The relative weight to give each `query_by` field when // ranking results. This can be used to boost fields in priority, when // looking for matches. Multiple fields are separated with a comma. QueryByWeights *string `json:"query_by_weights,omitempty"` // RemoteEmbeddingNumTries Number of times to retry fetching remote // embeddings. RemoteEmbeddingNumTries *int `json:"remote_embedding_num_tries,omitempty"` // RemoteEmbeddingTimeoutMs Timeout (in milliseconds) for fetching remote // embeddings. RemoteEmbeddingTimeoutMs *int `json:"remote_embedding_timeout_ms,omitempty"` // SearchCutoffMs Typesense will attempt to return results early if the // cutoff time has elapsed. This is not a strict guarantee and facet // computation is not bound by this parameter. SearchCutoffMs *int `json:"search_cutoff_ms,omitempty"` // SnippetThreshold Field values under this length will be fully // highlighted, instead of showing a snippet of relevant portion. Default: // 30 SnippetThreshold *int `json:"snippet_threshold,omitempty"` // SortBy A list of numerical fields and their corresponding sort orders // that will be used for ordering your results. Up to 3 sort fields can be // specified. The text similarity score is exposed as a special // `_text_match` field that you can use in the list of sorting fields. If no // `sort_by` parameter is specified, results are sorted by // `_text_match:desc,default_sorting_field:desc` SortBy *string `json:"sort_by,omitempty"` // TypoTokensThreshold If the number of results found for a specific query // is less than this number, Typesense will attempt to look for tokens with // more typos until enough results are found. Default: 100 TypoTokensThreshold *int `json:"typo_tokens_threshold,omitempty"` // UseCache Enable server side caching of search query results. By default, // caching is disabled. UseCache *bool `json:"use_cache,omitempty"` // VectorQuery Vector query expression for fetching documents "closest" to a // given query/document vector. VectorQuery *string `json:"vector_query,omitempty"` }
MultiSearchParameters Parameters for the multi search API.
type MultiSearchParams ¶
type MultiSearchParams struct {
MultiSearchParameters MultiSearchParameters `form:"multiSearchParameters" json:"multiSearchParameters"`
}
MultiSearchParams defines parameters for MultiSearch.
type MultiSearchResult ¶
type MultiSearchResult struct {
Results []ResultOrError `json:"results"`
}
type MultiSearchSearchesParameter ¶
type MultiSearchSearchesParameter struct {
Searches []MultiSearchCollectionParameters `json:"searches"`
}
MultiSearchSearchesParameter defines model for MultiSearchSearchesParameter.
type NodeStatus ¶
type OperationsService ¶
type OperationsService service
func (*OperationsService) ClearCache ¶
func (s *OperationsService) ClearCache(ctx context.Context) (*SuccessStatus, error)
func (*OperationsService) CompactDB ¶
func (s *OperationsService) CompactDB(ctx context.Context) (*SuccessStatus, error)
func (*OperationsService) ResetPeers ¶
func (s *OperationsService) ResetPeers(ctx context.Context) (*SuccessStatus, error)
func (*OperationsService) Snapshot ¶
func (s *OperationsService) Snapshot(ctx context.Context, opts *TakeSnapshotParams) (*SuccessStatus, error)
func (*OperationsService) Vote ¶
func (s *OperationsService) Vote(ctx context.Context) (*SuccessStatus, error)
type OverridesService ¶
type OverridesService service
func (*OverridesService) Delete ¶
func (s *OverridesService) Delete(ctx context.Context, collectionName, overrideId string) (*DeleteOverrideResponse, error)
func (*OverridesService) Get ¶
func (s *OverridesService) Get(ctx context.Context, collectionName, overrideId string) (*SearchOverride, error)
func (*OverridesService) List ¶
func (s *OverridesService) List(ctx context.Context, collectionName string) (*SearchOverridesResponse, error)
func (*OverridesService) Upsert ¶
func (s *OverridesService) Upsert(ctx context.Context, collectionName, overrideId string, body *SearchOverrideSchema) (*SearchOverride, error)
type PresetListResponse ¶
type PresetListResponse struct {
Presets []*Preset `json:"presets"`
}
type PresetUpsertSchema ¶
type PresetUpsertSchema struct {
Value interface{} `json:"value"`
}
type PresetsService ¶
type PresetsService service
func (*PresetsService) List ¶
func (s *PresetsService) List(ctx context.Context) (*PresetListResponse, error)
func (*PresetsService) Upsert ¶
func (s *PresetsService) Upsert(ctx context.Context, presetName string, body *PresetUpsertSchema) (*Preset, error)
type RateLimitAction ¶
type RateLimitAction string
const ( ALLOW RateLimitAction = "allow" BLOCK RateLimitAction = "block" THROTTLE RateLimitAction = "throttle" )
type RateLimitExceed ¶
type RateLimitResponse ¶
type RateLimitResponse struct { Message string `json:"message"` Rule *RateLimitRule `json:"rule"` }
type RateLimitRule ¶
type RateLimitRule struct { ID int `json:"id"` Action RateLimitAction `json:"action"` ApplyLimitPerEntity *bool `json:"apply_limit_per_entity,omitempty"` IpAddresses []string `json:"ip_addresses,omitempty"` ApiKeys []string `json:"api_keys,omitempty"` MaxRequests *struct { MinuteThreshold *int `json:"minute_threshold,omitempty"` HourThreshold *int `json:"hour_threshold,omitempty"` } `json:"max_requests,omitempty"` AutoBan1mThreshold *int `json:"auto_ban_1m_threshold,omitempty"` AutoBan1mDurationHours *int `json:"auto_ban_1m_duration_hours,omitempty"` Priority *int `json:"priority,omitempty"` }
type RateLimitRuleSchema ¶
type RateLimitRuleSchema struct { Action RateLimitAction `json:"action"` ApplyLimitPerEntity *bool `json:"apply_limit_per_entity,omitempty"` ApiAddresses []string `json:"ip_addresses,omitempty"` ApiKeys []string `json:"api_keys,omitempty"` MaxRequests1m *int `json:"max_requests_1m,omitempty"` MaxRequests1h *int `json:"max_requests_1h,omitempty"` AutoBan1mThreshold *int `json:"auto_ban_1m_threshold,omitempty"` AutoBan1mDurationHours *int `json:"auto_ban_1m_duration_hours,omitempty"` Priority *int `json:"priority:omitempty"` }
type RateLimitStateType ¶
type RateLimitStateType string
type RateLimitStatus ¶
type RateLimitsService ¶
type RateLimitsService service
func (*RateLimitsService) Create ¶
func (s *RateLimitsService) Create(ctx context.Context, body *RateLimitRuleSchema) (*RateLimitResponse, error)
func (*RateLimitsService) Delete ¶
func (s *RateLimitsService) Delete(ctx context.Context, id int) (*DeleteRateLimitResponse, error)
func (*RateLimitsService) DeleteActive ¶
func (s *RateLimitsService) DeleteActive(ctx context.Context, id int) (*DeleteRateLimitResponse, error)
func (*RateLimitsService) DeleteExceeds ¶
func (s *RateLimitsService) DeleteExceeds(ctx context.Context, id int) (*DeleteRateLimitResponse, error)
func (*RateLimitsService) Get ¶
func (s *RateLimitsService) Get(ctx context.Context, id int) (*RateLimitRule, error)
func (*RateLimitsService) List ¶
func (s *RateLimitsService) List(ctx context.Context) ([]*RateLimitRule, error)
func (*RateLimitsService) ListActive ¶
func (s *RateLimitsService) ListActive(ctx context.Context) ([]*RateLimitStatus, error)
func (*RateLimitsService) ListExceeds ¶
func (s *RateLimitsService) ListExceeds(ctx context.Context) ([]*RateLimitExceed, error)
func (*RateLimitsService) Update ¶
func (s *RateLimitsService) Update(ctx context.Context, id int, body *RateLimitRuleSchema) (*RateLimitResponse, error)
type RequestOption ¶
type ResultOrError ¶
type ResultOrError struct { SearchResult *SearchResult SearchError *SearchError }
func (*ResultOrError) UnmarshalJSON ¶
func (roe *ResultOrError) UnmarshalJSON(data []byte) error
type SearchCollectionParams ¶
type SearchCollectionParams struct {
SearchParameters SearchParameters `form:"searchParameters" json:"searchParameters"`
}
SearchCollectionParams defines parameters for SearchCollection.
type SearchError ¶
type SearchGroupedHit ¶
type SearchGroupedHit struct { Found *int `json:"found,omitempty"` GroupKey []interface{} `json:"group_key"` // Hits The documents that matched the search query Hits []SearchResultHit `json:"hits"` }
SearchGroupedHit defines model for SearchGroupedHit.
type SearchHighlight ¶
type SearchHighlight struct { Field *string `json:"field,omitempty"` // Indices The indices property will be present only for string[] fields and // will contain the corresponding indices of the snippets in the search // field Indices []int `json:"indices,omitempty"` MatchedTokens []string `json:"matched_tokens,omitempty"` // Snippet Present only for (non-array) string fields Snippet *string `json:"snippet,omitempty"` // Snippets Present only for (array) string[] fields Snippets []string `json:"snippets,omitempty"` // Value Full field value with highlighting, present only for (non-array) // string fields Value *string `json:"value,omitempty"` // Values Full field value with highlighting, present only for (array) // string[] fields Values []string `json:"values,omitempty"` }
SearchHighlight defines model for SearchHighlight.
type SearchOverride ¶
type SearchOverride struct { // Excludes List of document `id`s that should be excluded from the search // results. Excludes []*SearchOverrideExclude `json:"excludes,omitempty"` // FilterBy A filter by clause that is applied to any search query that // matches the override rule. FilterBy *string `json:"filter_by,omitempty"` Id *string `json:"id,omitempty"` // Includes List of document `id`s that should be included in the search // results with their corresponding `position`s. Includes []*SearchOverrideInclude `json:"includes,omitempty"` // RemoveMatchedTokens Indicates whether search query tokens that exist in // the override's rule should be removed from the search query. RemoveMatchedTokens *bool `json:"remove_matched_tokens,omitempty"` Rule SearchOverrideRule `json:"rule"` }
SearchOverride defines model for SearchOverride.
type SearchOverrideExclude ¶
type SearchOverrideExclude struct { // Id document id that should be excluded from the search results. Id string `json:"id"` }
SearchOverrideExclude defines model for SearchOverrideExclude.
type SearchOverrideInclude ¶
type SearchOverrideInclude struct { // Id document id that should be included Id string `json:"id"` // Position position number where document should be included in the search // results Position int `json:"position"` }
SearchOverrideInclude defines model for SearchOverrideInclude.
type SearchOverrideRule ¶
type SearchOverrideRule struct { // Match Indicates whether the match on the query term should be `exact` or // `contains`. If we want to match all queries that contained the word // `apple`, we will use the `contains` match instead. Match SearchOverrideRuleMatch `json:"match"` // Query Indicates what search queries should be overridden Query string `json:"query"` }
SearchOverrideRule defines model for SearchOverrideRule.
type SearchOverrideRuleMatch ¶
type SearchOverrideRuleMatch string
SearchOverrideRuleMatch Indicates whether the match on the query term should be `exact` or `contains`. If we want to match all queries that contained the word `apple`, we will use the `contains` match instead.
const ( Contains SearchOverrideRuleMatch = "contains" Exact SearchOverrideRuleMatch = "exact" )
Defines values for SearchOverrideRuleMatch.
type SearchOverrideSchema ¶
type SearchOverrideSchema struct { // Excludes List of document `id`s that should be excluded from the search // results. Excludes *[]SearchOverrideExclude `json:"excludes,omitempty"` // FilterBy A filter by clause that is applied to any search query that // matches the override rule. FilterBy *string `json:"filter_by,omitempty"` // Includes List of document `id`s that should be included in the search // results with their corresponding `position`s. Includes *[]SearchOverrideInclude `json:"includes,omitempty"` // RemoveMatchedTokens Indicates whether search query tokens that exist in // the override's rule should be removed from the search query. RemoveMatchedTokens *bool `json:"remove_matched_tokens,omitempty"` Rule SearchOverrideRule `json:"rule"` }
SearchOverrideSchema defines model for SearchOverrideSchema.
type SearchOverridesResponse ¶
type SearchOverridesResponse struct {
Overrides []*SearchOverride `json:"overrides"`
}
SearchOverridesResponse defines model for SearchOverridesResponse.
type SearchParameters ¶
type SearchParameters struct { // Q The query text to search for in the collection. Use * as the search // string to return all documents. This is typically useful when used in // conjunction with filter_by. Q string `url:"q"` // QueryBy A list of `string` fields that should be queried against. // Multiple fields are separated with a comma. QueryBy string `url:"query_by"` // Prefix Boolean field to indicate that the last word in the query should // be treated as a prefix, and not as a whole word. This is used for // building autocomplete and instant search interfaces. Defaults to true. Prefix *string `url:"prefix,omitempty"` // Infix If infix index is enabled for this field, infix searching can be // done on a per-field basis by sending a comma separated string parameter // called infix to the search query. This parameter can have 3 values; `off` // infix search is disabled, which is default `always` infix search is // performed along with regular search `fallback` infix search is performed // if regular search does not produce results Infix *string `url:"infix,omitempty"` // MaxExtraPrefix There are also 2 parameters that allow you to control the // extent of infix searching max_extra_prefix and max_extra_suffix which // specify the maximum number of symbols before or after the query that can // be present in the token. For example query "K2100" has 2 extra symbols in // "6PK2100". By default, any number of prefixes/suffixes can be present for // a match. MaxExtraPrefix *int `url:"max_extra_prefix,omitempty"` // MaxExtraSuffix There are also 2 parameters that allow you to control the // extent of infix searching max_extra_prefix and max_extra_suffix which // specify the maximum number of symbols before or after the query that can // be present in the token. For example query "K2100" has 2 extra symbols in // "6PK2100". By default, any number of prefixes/suffixes can be present for // a match. MaxExtraSuffix *int `url:"max_extra_suffix,omitempty"` // PreSegmentedQuery You can index content from any logographic language // into Typesense if you are able to segment / split the text into // space-separated words yourself before indexing and querying. // Set this parameter to true to do the same PreSegmentedQuery *bool `url:"pre_segmented_query,omitempty"` // Preset Search using a bunch of search parameters by setting this // parameter to the name of the existing Preset. Preset *string `url:"preset,omitempty"` // FilterBy Filter conditions for refining youropen api validator search // results. Separate multiple conditions with &&. FilterBy *string `url:"filter_by,omitmepty"` // QueryByWeights The relative weight to give each `query_by` field when // ranking results. This can be used to boost fields in priority, when // looking for matches. Multiple fields are separated with a comma. QueryByWeights *string `url:"query_by_weights,omitempty"` // In a multi-field matching context, this parameter determines how the // representative text match score of a record is calculated. // Possible values: `max_score` (default) or `max_weight`. TextMatchType *string `url:"text_match_type,omitempty"` // SortBy A list of numerical fields and their corresponding sort orders // that will be used for ordering your results. Up to 3 sort fields can be // specified. The text similarity score is exposed as a special // `_text_match` field that you can use in the list of sorting fields. If no // `sort_by` parameter is specified, results are sorted by // `_text_match:desc,default_sorting_field:desc` SortBy *string `url:"sort_by,omitempty"` // PrioritizeExactMatch Set this parameter to true to ensure that an exact // match is ranked above the others PrioritizeExactMatch *bool `url:"prioritize_exact_match,omitempty"` // PrioritizeTokenPosition Make Typesense prioritize documents where the // query words appear earlier in the text. PrioritizeTokenPosition *bool `url:"prioritize_token_position,omitempty"` // PinnedHits A list of records to unconditionally include in the search // results at specific positions. An example use case would be to feature or // promote certain items on the top of search results. A list of // `record_id:hit_position`. Eg: to include a record with ID 123 at Position // 1 and another record with ID 456 at Position 5, you'd specify // `123:1,456:5`. You could also use the Overrides feature to override // search results based on rules. Overrides are applied first, followed by // `pinned_hits` and finally `hidden_hits`. PinnedHits *string `url:"pinned_hits,omitempty"` // HiddenHits A list of records to unconditionally hide from search results. // A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, // you'd specify `123,456`. You could also use the Overrides feature to // override search results based on rules. Overrides are applied first, // followed by `pinned_hits` and finally `hidden_hits`. HiddenHits *string `url:"hidden_hits,omitempty"` // EnableOverrides If you have some overrides defined but want to disable // all of them during query time, you can do that by setting this parameter // to false EnableOverrides *bool `url:"enable_overrides,omitmepty"` // Page Results from this specific page number would be fetched. Page *int `url:"page,omitempty"` // PerPage Number of results to fetch per page. Default: 10 PerPage *int `url:"per_page,omitempty"` // Identifies the starting point to return hits from a result set. // Can be used as an alternative to the page parameter. Offset *int `url:"offset,omitempty"` // Number of hits to fetch. Can be used as an alternative to the per_page // parameter. Default: 10 Limit *int `url:"limit,omitempty"` // FacetBy A list of fields that will be used for faceting your results on. // Separate multiple fields with a comma. FacetBy *string `url:"facet_by,omitempty"` // MaxFacetValues Maximum number of facet values to be returned. MaxFacetValues *int `url:"max_facet_values,omitempty"` // FacetQuery Facet values that are returned can now be filtered via this // parameter. The matching facet text is also highlighted. For example, when // faceting by `category`, you can set `facet_query=category:shoe` to return // only facet values that contain the prefix "shoe". FacetQuery *string `url:"facet_query,omitempty"` FacetQueryNumTypes *int `url:"facet_query_num_typos,omitempty"` // GroupBy You can aggregate search results into groups or buckets by // specify one or more `group_by` fields. Separate multiple fields with a // comma. To group on a particular field, it must be a faceted field. GroupBy *string `url:"group_by,omitempty"` // GroupLimit Maximum number of hits to be returned for every group. If the // `group_limit` is set as `K` then only the top K hits in each group are // returned in the response. Default: 3 GroupLimit *int `url:"group_limit,omitempty"` // IncludeFields List of fields from the document to include in the search // result IncludeFields *string `url:"include_fields,omitempty"` // ExcludeFields List of fields from the document to exclude in the search // result ExcludeFields *string `url:"exclude_fields,omitempty"` // HighlightFields A list of custom fields that must be highlighted even if // you don't query for them HighlightFields *string `url:"highlight_fields,omitempty"` // HighlightFullFields List of fields which should be highlighted fully // without snippeting HighlightFullFields *string `url:"highlight_full_fields,omitempty"` // HighlightAffixNumTokens The number of tokens that should surround the // highlighted text on each side. Default: 4 HighlightAffixNumTokens *int `url:"highlight_affix_num_tokens,omitempty"` // HighlightStartTag The start tag used for the highlighted snippets. // Default: `<mark>` HighlightStartTag *string `url:"highlight_start_tag,omitempty"` // HighlightEndTag The end tag used for the highlighted snippets. // Default: `</mark>` HighlightEndTag *string `url:"highlight_end_tag,omitempty"` // EnableHighlightV1 Flag for enabling/disabling the deprecated, // old highlight structure in the response. Default: true EnableHighlightV1 *bool `url:"enable_highlight_v1,omitempty"` // SnippetThreshold Field values under this length will be fully // highlighted, instead of showing a snippet of relevant portion. Default: 30 SnippetThreshold *int `url:"snippet_threshold,omitempty"` // Maximum number of hits that can be fetched from the collection. // `page` * `per_page` should be less than this number for the search request // to return results. Default: no limit LimitHits *int `url:"limit_hits,omitempty"` // SearchCutoffMs Typesense will attempt to return results early if the // cutoff time has elapsed. This is not a strict guarantee and facet // computation is not bound by this parameter. SearchCutoffMs *int `url:"search_cutoff_ms,omitempty"` // MaxCandidates Control the number of words that Typesense considers for // typo and prefix searching. MaxCandidates *int `url:"max_candidates,omitempty"` // ExhaustiveSearch Setting this to true will make Typesense consider all // prefixes and typo corrections of the words in the query without stopping // early when enough results are found (drop_tokens_threshold and // typo_tokens_threshold configurations are ignored). ExhaustiveSearch *bool `url:"exhaustive_search,omitempty"` // NumTypos The number of typographical errors (1 or 2) that would be tolerated. // Default: 2 NumTypos *string `url:"num_typos,omitempty"` // MinLen1typo Minimum word length for 1-typo correction to be applied. // The value of num_typos is still treated as the maximum allowed typos. MinLen1typo *int `url:"min_len_1typo,omitempty"` // MinLen2typo Minimum word length for 2-typo correction to be applied. // The value of num_typos is still treated as the maximum allowed typos. MinLen2typo *int `url:"min_len_2type,omitempty"` // SplitJoinTokens Treat space as typo: search for q=basket ball if // q=basketball is not found or vice-versa. Splitting/joining of tokens will // only be attempted if the original query produces no results. To always // trigger this behavior, set value to `always`. To disable, set value to // `off`. Default is `fallback`. SplitJoinTokens *string `url:"split_join_tokes,omitempty"` // TypoTokensThreshold If the number of results found for a specific query // is less than this number, Typesense will attempt to look for tokens with // more typos until enough results are found. Default: 100 TypoTokensThreshold *int `url:"typo_tokens_threshold,omitempty"` // DropTokensThreshold If the number of results found for a specific query // is less than this number, Typesense will attempt to drop the tokens in // the query until enough results are found. Tokens that have the least // individual hits are dropped first. Set to 0 to disable. Default: 10 DropTokensThreshold *int `url:"drop_tokens_threshold,omitempty"` // UseCache Enable server side caching of search query results. // By default, caching is disabled. UseCache *bool `url:"use_cache,omitempty"` // CacheTtl The duration (in seconds) that determines how long the search // query is cached. This value can be set on a per-query basis. Default: 60. CacheTtl *int `url:"cache_ttl,omitempty"` // RemoteEmbeddingNumTries Number of times to retry fetching remote // embeddings. RemoteEmbeddingNumTries *int `url:"remote_embedding_num_tries,omitempty"` // RemoteEmbeddingTimeoutMs Timeout (in milliseconds) for fetching remote // embeddings. RemoteEmbeddingTimeoutMs *int `url:"remote_embedding_timeout_ms,omitempty"` // VectorQuery Vector query expression for fetching documents "closest" to a // given query/document vector. VectorQuery *string `url:"vector_query,omitempty"` }
type SearchResult ¶
type SearchResult struct { FacetCounts []*FacetCounts `json:"facet_counts,omitempty"` // Found The number of documents found Found *int `json:"found,omitempty"` FoundDocs *int `json:"found_docs,omitempty"` GroupedHits []*SearchGroupedHit `json:"grouped_hits,omitempty"` // Hits The documents that matched the search query Hits []*SearchResultHit `json:"hits,omitempty"` // OutOf The total number of documents in the collection OutOf *int `json:"out_of,omitempty"` // Page The search result page number Page *int `json:"page,omitempty"` RequestParams *struct { CollectionName string `json:"collection_name"` PerPage int `json:"per_page"` Q string `json:"q"` } `json:"request_params,omitempty"` // SearchCutoff Whether the search was cut off SearchCutoff *bool `json:"search_cutoff,omitempty"` // SearchTimeMs The number of milliseconds the search took SearchTimeMs *int `json:"search_time_ms,omitempty"` }
SearchResult defines model for SearchResult.
type SearchResultHit ¶
type SearchResultHit struct { // Document Can be any key-value pair Document map[string]interface{} `json:"document,omitempty"` // GeoDistanceMeters Can be any key-value pair GeoDistanceMeters map[string]int `json:"geo_distance_meters,omitempty"` // Highlight Highlighted version of the matching document Highlight map[string]interface{} `json:"highlight,omitempty"` // Highlights (Deprecated) Contains highlighted portions of the search // fields Highlights []*SearchHighlight `json:"highlights,omitempty"` TextMatch *int64 `json:"text_match,omitempty"` TextMatchInfo struct { BestFieldScore string `json:"best_field_score"` BestFieldWeight int `json:"best_field_weight"` FieldsMatched int `json:"fields_matched"` Score string `json:"score"` TokensMatched int `json:"tokens_matched"` } `json:"text_match_info"` // VectorDistance Distance between the query vector and matching document's // vector value VectorDistance *float32 `json:"vector_distance,omitempty"` }
SearchResultHit defines model for SearchResultHit.
type SearchSynonym ¶
type SearchSynonym struct { Id *string `json:"id,omitempty"` // Root For 1-way synonyms, indicates the root word that words in the // `synonyms` parameter map to. Root *string `json:"root,omitempty"` // Synonyms Array of words that should be considered as synonyms. Synonyms []string `json:"synonyms"` }
SearchSynonym defines model for SearchSynonym.
type SearchSynonymSchema ¶
type SearchSynonymSchema struct { // Root For 1-way synonyms, indicates the root word that words in the // `synonyms` parameter map to. Root *string `json:"root,omitempty"` // Synonyms Array of words that should be considered as synonyms. Synonyms []string `json:"synonyms"` }
SearchSynonymSchema defines model for SearchSynonymSchema.
type SearchSynonymsResponse ¶
type SearchSynonymsResponse struct {
Synonyms []*SearchSynonym `json:"synonyms"`
}
SearchSynonymsResponse defines model for SearchSynonymsResponse.
type Stats ¶
type Stats struct { DeleteLatencyMS float32 `json:"delete_latency_ms"` DeleteRequestsPerSecond float32 `json:"delete_requests_per_second"` ImportLatencyMS float32 `json:"import_latency_ms"` ImportRequestsPerSecond float32 `json:"import_requests_per_second"` LatencyMS map[string]float32 `json:"latency_ms"` OverloadedRequestsPerSecond float32 `json:"overloaded_requests_per_second"` PendingWriteBatches float32 `json:"pending_write_batches"` RequestsPerSecond map[string]float32 `json:"requests_per_second"` SearchLatencyMS float32 `json:"search_latency_ms"` SearchRequestsPerSecond float32 `json:"search_requests_per_second"` TotalRequestsPerSecond float32 `json:"total_requests_per_second"` WriteLatencyMS float32 `json:"write_latency_ms"` WriteRequestsPerSecond float32 `json:"write_requests_per_second"` }
type SuccessStatus ¶
type SuccessStatus struct {
Success bool `json:"success"`
}
SuccessStatus defines model for SuccessStatus.
type SynonymsService ¶
type SynonymsService service
func (*SynonymsService) Delete ¶
func (s *SynonymsService) Delete(ctx context.Context, collectionName, synonymId string) (*DeleteSynonymResponse, error)
func (*SynonymsService) Get ¶
func (s *SynonymsService) Get(ctx context.Context, collectionName, synonymId string) (*SearchSynonym, error)
func (*SynonymsService) List ¶
func (s *SynonymsService) List(ctx context.Context, collectionName string) (*SearchSynonymsResponse, error)
func (*SynonymsService) Upsert ¶
func (s *SynonymsService) Upsert(ctx context.Context, collectionName, synonymId string, body *SearchSynonymSchema) (*SearchSynonym, error)
type TakeSnapshotParams ¶
type TakeSnapshotParams struct { // SnapshotPath The directory on the server where the snapshot should be // saved. SnapshotPath string `form:"snapshot_path" json:"snapshot_path"` }
TakeSnapshotParams defines parameters for TakeSnapshot.
type UpdateByQueryResponse ¶
type UpdateByQueryResponse struct {
NumUpdated int `json:"num_updated"`
}
type UpdateCollectionJSONRequestBody ¶
type UpdateCollectionJSONRequestBody = CollectionUpdateSchema
UpdateCollectionJSONRequestBody defines body for UpdateCollection for application/json ContentType.
type UpdateDocumentJSONBody ¶
type UpdateDocumentJSONBody = interface{}
UpdateDocumentJSONBody defines parameters for UpdateDocument.
type UpdateDocumentJSONRequestBody ¶
type UpdateDocumentJSONRequestBody = UpdateDocumentJSONBody
UpdateDocumentJSONRequestBody defines body for UpdateDocument for application/json ContentType.
type UpdateDocumentsJSONBody ¶
type UpdateDocumentsJSONBody = interface{}
UpdateDocumentsJSONBody defines parameters for UpdateDocuments.
type UpdateDocumentsJSONRequestBody ¶
type UpdateDocumentsJSONRequestBody = UpdateDocumentsJSONBody
UpdateDocumentsJSONRequestBody defines body for UpdateDocuments for application/json ContentType.
type UpdateDocumentsParams ¶
type UpdateDocumentsParams struct { UpdateDocumentsParameters *struct { FilterBy *string `json:"filter_by,omitempty"` } `form:"updateDocumentsParameters,omitempty" json:"updateDocumentsParameters,omitempty"` }
UpdateDocumentsParams defines parameters for UpdateDocuments.
type UpdateOptions ¶
type UpdateOptions struct { FilterBy string `url:"filter_by,omitempty"` DirtyValues DirtyValuesOptions `url:"dirty_values,omitmepty"` }
type UpsertAliasJSONRequestBody ¶
type UpsertAliasJSONRequestBody = CollectionAliasSchema
UpsertAliasJSONRequestBody defines body for UpsertAlias for application/json ContentType.
type UpsertSearchOverrideJSONRequestBody ¶
type UpsertSearchOverrideJSONRequestBody = SearchOverrideSchema
UpsertSearchOverrideJSONRequestBody defines body for UpsertSearchOverride for application/json ContentType.
type UpsertSearchSynonymJSONRequestBody ¶
type UpsertSearchSynonymJSONRequestBody = SearchSynonymSchema
UpsertSearchSynonymJSONRequestBody defines body for UpsertSearchSynonym for application/json ContentType.