Documentation
¶
Index ¶
- Constants
- type DocumentFilter
- type Engine
- func (e *Engine) AddIndex() error
- func (e *Engine) DeleteDocument(docId string, userId int) error
- func (e *Engine) DeleteDocuments(userId int) error
- func (e *Engine) GetHealth() (string, bool, error)
- func (e *Engine) GetIndexStatus() (IndexStatus, error)
- func (e *Engine) GetStatus() (*EngineStatus, error)
- func (e *Engine) IndexDocuments(docs *[]models.Document, userId int) error
- func (e *Engine) SearchDocuments(userId int, query string, sort storage.SortKey, paging storage.Paging) ([]*models.Document, int, error)
- func (e *Engine) SuggestSearch(userId int, query string) (*QuerySuggestions, error)
- type EngineStatus
- type IndexStatus
- type QuerySuggestions
- type Suggestion
Constants ¶
const ( SuggestionTypeMetadata = "metadata" SuggestionTypeOperand = "operand" SuggestionTypeKey = "key" )
const MaxSuggestMetadata = 10
max for either metadate keys or values
const MaxSuggestions = 50
total maximum for suggestions
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocumentFilter ¶
type DocumentFilter struct { Query string `json:"q"` Tag string `json:"tag"` After time.Time `json:"after"` Before time.Time `json:"before"` Metadata string `json:"metadata"` Sort string `json:"sort"` SortMode string `json:"sort_mode"` Favorite bool `json:"favorite"` }
DocumentFilter defines filter for searching/filtering documents
type Engine ¶
Engine is as search engine that uses Meilisearch to provide full-text-search across documents.
func (*Engine) DeleteDocuments ¶
func (*Engine) GetIndexStatus ¶ added in v0.6.0
func (e *Engine) GetIndexStatus() (IndexStatus, error)
func (*Engine) GetStatus ¶
func (e *Engine) GetStatus() (*EngineStatus, error)
func (*Engine) IndexDocuments ¶
IndexDocuments sends documents to meilisearch for indexing
func (*Engine) SearchDocuments ¶
func (e *Engine) SearchDocuments(userId int, query string, sort storage.SortKey, paging storage.Paging) ([]*models.Document, int, error)
SearchDocuments searches documents for given user. Query can be anything. If field="", search in any field, else search only specified field
func (*Engine) SuggestSearch ¶
func (e *Engine) SuggestSearch(userId int, query string) (*QuerySuggestions, error)
type EngineStatus ¶
type IndexStatus ¶ added in v0.6.0
type QuerySuggestions ¶
type QuerySuggestions struct { Suggestions []Suggestion `json:"suggestions"` Prefix string `json:"prefix"` ValidQuery bool `json:"valid_query"` }
QuerySuggestions contains the current normalized query and suggestions. Concatenating the prefix with any suggestion results in valid query. e.g. query 'some data' results in prefix 'some' and suggestion: ['metadata:', 'datavalue:']