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, error)
- func IndexObj(object Indexable)
- func Initialize(config *config.Conf)
- func LoadIndex() error
- func ReIndex(objects []Indexable) error
- func SaveIndex() error
- type Document
- type FileIndex
- func (i *FileIndex) Clear() error
- func (i *FileIndex) CreateCollection(idxName string) error
- func (i *FileIndex) DeleteCollection(idxName string) error
- func (i *FileIndex) DeleteItem(idxName string, doc string) error
- func (i *FileIndex) Endpoints() ([]string, error)
- func (i *FileIndex) GobDecode(buf []byte) error
- func (i *FileIndex) GobEncode() ([]byte, error)
- func (i *FileIndex) Initialize() error
- func (i *FileIndex) Load() error
- func (i *FileIndex) Save() error
- func (i *FileIndex) SaveItem(object Indexable) error
- func (i *FileIndex) Search(idx string, term string, notop bool) (map[string]Document, error)
- func (i *FileIndex) SearchRange(idx string, field string, start string, end string, inclusive bool) (map[string]Document, error)
- func (i *FileIndex) SearchResults(term string, notop bool, docs map[string]Document) (map[string]Document, error)
- func (i *FileIndex) SearchResultsRange(field string, start string, end string, inclusive bool, ...) (map[string]Document, error)
- func (i *FileIndex) SearchResultsText(term string, notop bool, docs map[string]Document) (map[string]Document, error)
- func (i *FileIndex) SearchText(idx string, term string, notop bool) (map[string]Document, 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 IndexCollection
- type Indexable
- type ObjIndexer
- type PostgresIndex
- func (p *PostgresIndex) Clear() error
- func (p *PostgresIndex) CreateCollection(col string) error
- func (p *PostgresIndex) DeleteCollection(col string) error
- func (p *PostgresIndex) DeleteItem(idxName string, doc string) error
- func (p *PostgresIndex) Endpoints() ([]string, error)
- func (p *PostgresIndex) Initialize() error
- func (p *PostgresIndex) SaveItem(obj Indexable) error
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 Initialize ¶ added in v0.10.0
Types ¶
type FileIndex ¶ added in v0.10.0
type FileIndex struct {
// contains filtered or unexported fields
}
func (*FileIndex) CreateCollection ¶ added in v0.10.0
func (*FileIndex) DeleteCollection ¶ added in v0.10.0
func (*FileIndex) DeleteItem ¶ added in v0.10.0
func (*FileIndex) Endpoints ¶ added in v0.10.0
Endpoints returns a list of currently indexed endpoints.
func (*FileIndex) Initialize ¶ added in v0.10.0
func (*FileIndex) SearchRange ¶ added in v0.10.0
func (*FileIndex) SearchResults ¶ added in v0.10.0
func (i *FileIndex) SearchResults(term string, notop bool, docs map[string]Document) (map[string]Document, error)
SearchResults does a basic search from an existing collection of documents, rather than the full index.
func (*FileIndex) SearchResultsRange ¶ added in v0.10.0
func (i *FileIndex) SearchResultsRange(field string, start string, end string, inclusive bool, docs map[string]Document) (map[string]Document, error)
SearchResultsRange does a range search on a collection of search results, rather than the full index.
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.
type Index ¶
type Index interface { Search(string, string, bool) (map[string]Document, error) SearchText(string, string, bool) (map[string]Document, error) SearchRange(string, string, string, string, bool) (map[string]Document, error) SearchResults(string, bool, map[string]Document) (map[string]Document, error) SearchResultsRange(string, string, string, bool, map[string]Document) (map[string]Document, error) SearchResultsText(string, bool, map[string]Document) (map[string]Document, error) Save() error Load() error ObjIndexer }
Index holds a map of document collections.
type IndexCollection ¶ added in v0.10.0
type IndexCollection interface {
// contains filtered or unexported methods
}
type Indexable ¶
Indexable is an interface that provides all the information necessary to index an object. All objects that will be indexed need to implement this.
type ObjIndexer ¶ added in v0.10.0
type PostgresIndex ¶ added in v0.10.0
type PostgresIndex struct { }
func (*PostgresIndex) Clear ¶ added in v0.10.0
func (p *PostgresIndex) Clear() error
func (*PostgresIndex) CreateCollection ¶ added in v0.10.0
func (p *PostgresIndex) CreateCollection(col string) error
func (*PostgresIndex) DeleteCollection ¶ added in v0.10.0
func (p *PostgresIndex) DeleteCollection(col string) error
func (*PostgresIndex) DeleteItem ¶ added in v0.10.0
func (p *PostgresIndex) DeleteItem(idxName string, doc string) error
func (*PostgresIndex) Endpoints ¶ added in v0.10.0
func (p *PostgresIndex) Endpoints() ([]string, error)
func (*PostgresIndex) Initialize ¶ added in v0.10.0
func (p *PostgresIndex) Initialize() error
func (*PostgresIndex) SaveItem ¶ added in v0.10.0
func (p *PostgresIndex) SaveItem(obj Indexable) error