Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateDocsResp ¶
type DeviceDefinitionSearchDoc ¶
type DeviceDefinitionSearchDoc struct {
ID string `json:"id"`
// SearchDisplay M+M+Y
SearchDisplay string `json:"search_display"`
Make string `json:"make"`
Model string `json:"model"`
Year int `json:"year"`
// SubModels: M+M+Y+Submodel name
SubModels []string `json:"sub_models"`
ImageURL string `json:"image_url"`
}
DeviceDefinitionSearchDoc used for elastic search document indexing. entirely for searching, source of truth is DB. elastic only supports lowercase letters, number and underscores, ie. snake_case
type EngineDetail ¶
type EngineDetail struct {
Name string `json:"name"`
Language *string `json:"language,omitempty"`
Type *string `json:"type,omitempty"`
DocumentCount *int `json:"document_count,omitempty"`
SourceEngines []string `json:"source_engines,omitempty"`
}
EngineDetail can be used as a response when listing engines, or to create an engine. The minimum parameters are Name. Type and Source can be used when dealing with Meta Engines: https://www.elastic.co/guide/en/app-search/current/meta-engines.html
type GetEnginesResp ¶
type GetEnginesResp struct {
Meta struct {
Page struct {
Current int `json:"current"`
TotalPages int `json:"total_pages"`
TotalResults int `json:"total_results"`
Size int `json:"size"`
} `json:"page"`
} `json:"meta"`
Results []EngineDetail `json:"results"`
}
type SearchService ¶
type SearchService interface {
LoadDeviceDefinitions() error
GetEngines() (*GetEnginesResp, error)
CreateEngine(name string, metaSource *string) (*EngineDetail, error)
AddSourceEngineToMetaEngine(sourceName, metaName string) (*EngineDetail, error)
RemoveSourceEngine(sourceName, metaName string) (*EngineDetail, error)
DeleteEngine(name string) error
CreateDocuments(docs []DeviceDefinitionSearchDoc, engineName string) ([]CreateDocsResp, error)
CreateDocumentsBatched(docs []DeviceDefinitionSearchDoc, engineName string) error
UpdateSearchSettingsForDeviceDefs(engineName string) error
GetMetaEngineName() string
}
func NewElasticSearchService ¶
Click to show internal directories.
Click to hide internal directories.