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) (search.Document, error)
- func (b *BleveIndexer) Documents(IDs []string) ([]search.Document, error)
- func (b *BleveIndexer) ID(meta DocumentWrite, file string) string
- func (b *BleveIndexer) RemoveFile(file string) error
- func (b *BleveIndexer) SameAuthors(slug string, quantity int) ([]search.Document, error)
- func (b *BleveIndexer) SameSeries(slug string, quantity int) ([]search.Document, error)
- func (b *BleveIndexer) SameSubjects(slug string, quantity int) ([]search.Document, error)
- func (b *BleveIndexer) Search(keywords string, page, resultsPerPage int) (*search.PaginatedResult, error)
- func (b *BleveIndexer) Slug(document DocumentWrite, batchSlugs map[string]struct{}) string
- type DocumentWrite
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 (*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) (search.Document, error)
func (*BleveIndexer) Documents ¶ added in v3.8.0
func (b *BleveIndexer) Documents(IDs []string) ([]search.Document, error)
func (*BleveIndexer) ID ¶ added in v3.6.0
func (b *BleveIndexer) ID(meta DocumentWrite, file string) string
func (*BleveIndexer) RemoveFile ¶
func (b *BleveIndexer) RemoveFile(file string) error
RemoveFile removes a file from the index
func (*BleveIndexer) SameAuthors ¶ added in v3.5.0
SameAuthors returns an array of metadata of documents by the same authors which does not belong to the same collection
func (*BleveIndexer) SameSeries ¶ added in v3.5.0
SameSeries returns an array of metadata of documents in the same series
func (*BleveIndexer) SameSubjects ¶ added in v3.5.0
SameSubjects returns an array of metadata of documents by other authors, different between each other, which have similar subjects as the passed one and does not belong to the same collection
func (*BleveIndexer) Search ¶
func (b *BleveIndexer) Search(keywords string, page, resultsPerPage int) (*search.PaginatedResult, error)
Search look for documents which match with the passed keywords. Returns a maximum <resultsPerPage> books, offset by <page>
func (*BleveIndexer) Slug ¶ added in v3.6.0
func (b *BleveIndexer) Slug(document DocumentWrite, batchSlugs map[string]struct{}) string
As Bleve index is not updated until the batch is executed, we need to store the slugs processed in the current batch in memory to also compare the current doc slug against them.