Documentation ¶
Overview ¶
The functions in this file were taken from https://github.com/akrylysov/simplefts
Index ¶
- type Document
- type DocumentJson
- type Index
- func (i *Index) AddDocument(id string, doc map[string]interface{}) (string, error)
- func (i *Index) Build() error
- func (i *Index) DeleteDocument(documentId string)
- func (i *Index) Destroy()
- func (i *Index) GetDocument(documentId string) (Document, bool)
- func (i *Index) ReplaceDocument(document DocumentJson)
- func (i *Index) SearchValue(value string) []string
- func (i *Index) Validate() error
- type IndexManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocumentJson ¶
type DocumentJson struct { Id string `json:"id"` Document interface{} `json:"document"` }
type Index ¶
type Index struct { Id string `json:"id"` SearchProperties []string `json:"searchProperties"` Documents []Document `json:"documents,omitempty"` InvertedIndex map[string][]string `json:"-"` // contains filtered or unexported fields }
Index struct
func (*Index) AddDocument ¶
AddDocument adds a document to the index
func (*Index) DeleteDocument ¶
DeleteDocument deletes a document from the index
func (*Index) Destroy ¶
func (i *Index) Destroy()
Destroy destroys the data assoicated with the index
func (*Index) GetDocument ¶
GetDocument gets a document from the index.
func (*Index) ReplaceDocument ¶
func (i *Index) ReplaceDocument(document DocumentJson)
Replace document replaces a document in an index.
func (*Index) SearchValue ¶
type IndexManager ¶
type IndexManager struct { Path string `json:"-"` Indexes map[string]*Index `json:"indexes"` Cache *cache.Cache `json:"-"` // contains filtered or unexported fields }
func NewIndexManager ¶
func NewIndexManager(path string, cache *cache.Cache) *IndexManager
NewIndexManager creates a new index manager object
func (*IndexManager) AddIndex ¶
func (indexManager *IndexManager) AddIndex(index *Index) error
AddIndex adds an index
func (*IndexManager) DeleteIndex ¶
func (indexManager *IndexManager) DeleteIndex(indexId string) error
DeleteIndex deletes an index
func (*IndexManager) GetIndex ¶
func (indexManager *IndexManager) GetIndex(indexId string) (*Index, bool)
GetIndex returns an index
func (*IndexManager) Save ¶
func (indexManager *IndexManager) Save() error
Save saves the indexes to persistent storage
Click to show internal directories.
Click to hide internal directories.