Documentation ¶
Overview ¶
Package index provides interfaces for indexing ebooks metadata and retrieving this metadata back from the index. Currently, there is only one implementation to those interfaces, using Bleve.
Index ¶
- func Mapping() *mapping.IndexMappingImpl
- type BleveIndexer
- func (b *BleveIndexer) AddFile(file string) error
- func (b *BleveIndexer) AddLibrary(fs afero.Fs, batchSize int) error
- func (b *BleveIndexer) Close() error
- func (b *BleveIndexer) Count() (uint64, error)
- func (b *BleveIndexer) Document(slug string) (metadata.Metadata, error)
- func (b *BleveIndexer) RemoveFile(file string) error
- func (b *BleveIndexer) Search(keywords string, page, resultsPerPage int, wordsPerMinute float64) (*controller.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mapping ¶
func Mapping() *mapping.IndexMappingImpl
Types ¶
type BleveIndexer ¶
type BleveIndexer struct {
// contains filtered or unexported fields
}
func NewBleve ¶
func NewBleve(index bleve.Index, libraryPath string, read map[string]metadata.Reader) *BleveIndexer
NewBleve creates a new BleveIndexer instance using the passed parameters
func (*BleveIndexer) AddFile ¶
func (b *BleveIndexer) AddFile(file string) error
AddFile adds a file to the index
func (*BleveIndexer) AddLibrary ¶
func (b *BleveIndexer) AddLibrary(fs afero.Fs, batchSize int) error
AddLibrary scans <libraryPath> for books and adds them to the index in batches of <bathSize>
func (*BleveIndexer) Count ¶
func (b *BleveIndexer) Count() (uint64, error)
Count returns the number of indexed books
func (*BleveIndexer) Document ¶
func (b *BleveIndexer) Document(slug string) (metadata.Metadata, error)
func (*BleveIndexer) RemoveFile ¶
func (b *BleveIndexer) RemoveFile(file string) error
RemoveFile removes a file from the index
func (*BleveIndexer) Search ¶
func (b *BleveIndexer) Search(keywords string, page, resultsPerPage int, wordsPerMinute float64) (*controller.Result, error)
Search look for documents which match with the passed keywords. Returns a maximum <resultsPerPage> books, offset by <page>
Click to show internal directories.
Click to hide internal directories.