Documentation ¶
Overview ¶
Package indexer indexes objects that implement the Indexable interface. The index is all in memory right now, but it can be frozen and saved to disk for persistence.
Index ¶
- func ClearIndex()
- func CreateNewCollection(idxName string)
- func DeleteCollection(idxName string) error
- func DeleteItemFromCollection(idxName string, doc string) error
- func Endpoints() []string
- func IndexObj(object Indexable)
- func LoadIndex(idxFile string) error
- func ReIndex(objects []Indexable) error
- func SaveIndex(idxFile string) error
- func SearchIndex(idxName string, term string, notop bool) (map[string]*IdxDoc, error)
- func SearchRange(idxName string, field string, start string, end string, inclusive bool) (map[string]*IdxDoc, error)
- func SearchResults(term string, notop bool, docs map[string]*IdxDoc) (map[string]*IdxDoc, error)
- func SearchResultsRange(field string, start string, end string, inclusive bool, ...) (map[string]*IdxDoc, error)
- func SearchResultsText(term string, notop bool, docs map[string]*IdxDoc) (map[string]*IdxDoc, error)
- func SearchText(idxName string, term string, notop bool) (map[string]*IdxDoc, error)
- type IdxCollection
- type IdxDoc
- func (idoc *IdxDoc) Examine(term string) (bool, error)
- func (idoc *IdxDoc) GobDecode(buf []byte) error
- func (idoc *IdxDoc) GobEncode() ([]byte, error)
- func (idoc *IdxDoc) RangeSearch(field string, start string, end string, inclusive bool) (bool, error)
- func (idoc *IdxDoc) TextSearch(term string) (bool, error)
- type Index
- type Indexable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNewCollection ¶
func CreateNewCollection(idxName string)
CreateNewCollection creates an index for data bags when they are created, rather than when the first data bag item is uploaded
func DeleteCollection ¶
DeleteCollection deletes a collection from the index. Useful only for data bags.
func DeleteItemFromCollection ¶
DeleteItemFromCollection deletes an item from a collection
func SearchIndex ¶
SearchIndex searches for a string in the given index. Returns a slice of names of matching objects, or an error on failure.
func SearchRange ¶
func SearchRange(idxName string, field string, start string, end string, inclusive bool) (map[string]*IdxDoc, error)
SearchRange performs a range search on the given index.
func SearchResults ¶ added in v0.9.1
SearchResults does a basic search from an existing collection of documents, rather than the full index.
func SearchResultsRange ¶ added in v0.9.1
func SearchResultsRange(field string, start string, end string, inclusive bool, docs map[string]*IdxDoc) (map[string]*IdxDoc, error)
SearchResultsRange does a range search on a collection of search results, rather than the full index.
Types ¶
type IdxCollection ¶
type IdxCollection struct {
// contains filtered or unexported fields
}
IdxCollection holds a map of documents.
func (*IdxCollection) GobDecode ¶ added in v0.3.0
func (ic *IdxCollection) GobDecode(buf []byte) error
func (*IdxCollection) GobEncode ¶ added in v0.3.0
func (ic *IdxCollection) GobEncode() ([]byte, error)
type IdxDoc ¶
type IdxDoc struct {
// contains filtered or unexported fields
}
IdxDoc is the indexed documents that are actually searched.
func (*IdxDoc) Examine ¶
Examine searches a document, determining if it needs to do a search for an exact term or a regexp search.