indexer

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Index objects that implement the Indexable interface. All in memory right now, but the possibility is open to later saving the index to disk for later use if a full solr installation (with the attendant improved functionality, admittedly) is not needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearIndex added in v0.3.3

func ClearIndex()

Clear index of all collections and documents

func CreateNewCollection

func CreateNewCollection(idxName string)

Create an index for data bags when they are created, rather than when the first data bag item is uploaded

func DeleteCollection

func DeleteCollection(idxName string) error

Delete a collection from the index. Useful only for data bags.

func DeleteItemFromCollection

func DeleteItemFromCollection(idxName string, doc string) error

Delete an item from a collection

func Endpoints

func Endpoints() []string

Return a list of currently indexed endpoints

func IndexObj

func IndexObj(object Indexable)

Process and add an object to the index.

func LoadIndex added in v0.3.0

func LoadIndex(idxFile string) error

Load index files from disk.

func ReIndex added in v0.3.3

func ReIndex(objects []Indexable) error

Rebuild the search index from scratch

func SaveIndex added in v0.3.0

func SaveIndex(idxFile string) error

Save the index files to disk.

func SearchIndex

func SearchIndex(idxName string, term string, notop bool) (map[string]*IdxDoc, error)

Search 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)

Perform a range search on the given index.

func SearchText

func SearchText(idxName string, term string, notop bool) (map[string]*IdxDoc, error)

Perform a full-ish text search of the index.

Types

type IdxCollection

type IdxCollection struct {
	// contains filtered or unexported fields
}

Holds a map of documents.

func (*IdxCollection) GobDecode added in v0.3.0

func (i *IdxCollection) GobDecode(buf []byte) error

func (*IdxCollection) GobEncode added in v0.3.0

func (i *IdxCollection) GobEncode() ([]byte, error)

type IdxDoc

type IdxDoc struct {
	// contains filtered or unexported fields
}

The indexed documents that are actually searched.

func (*IdxDoc) Examine

func (idoc *IdxDoc) Examine(term string) (bool, error)

func (*IdxDoc) GobDecode added in v0.3.0

func (i *IdxDoc) GobDecode(buf []byte) error

func (*IdxDoc) GobEncode added in v0.3.0

func (i *IdxDoc) GobEncode() ([]byte, error)

func (*IdxDoc) RangeSearch

func (idoc *IdxDoc) RangeSearch(field string, start string, end string, inclusive bool) (bool, error)

func (*IdxDoc) TextSearch

func (idoc *IdxDoc) TextSearch(term string) (bool, error)

type Index

type Index struct {
	// contains filtered or unexported fields
}

Holds a map of document collections.

func (*Index) GobDecode added in v0.3.0

func (i *Index) GobDecode(buf []byte) error

func (*Index) GobEncode added in v0.3.0

func (i *Index) GobEncode() ([]byte, error)

type Indexable

type Indexable interface {
	DocId() string
	Index() string
	Flatten() []string
}

Interface that provides all the information necessary to index an object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL