Indexing everything
This commit is contained in:
+17
-4
@@ -8,9 +8,10 @@ import (
|
||||
)
|
||||
|
||||
type Search interface {
|
||||
ClearAll() error
|
||||
IndexArtist(ar *domain.Artist) error
|
||||
//IndexAlbum(al domain.Album) error
|
||||
//IndexMediaFile(mf domain.MediaFile) error
|
||||
IndexAlbum(al *domain.Album) error
|
||||
IndexMediaFile(mf *domain.MediaFile) error
|
||||
}
|
||||
|
||||
type search struct {
|
||||
@@ -24,6 +25,18 @@ func NewSearch(ar domain.ArtistRepository, alr domain.AlbumRepository, mr domain
|
||||
return search{ar, alr, mr, idx}
|
||||
}
|
||||
|
||||
func (s search) IndexArtist(ar *domain.Artist) error {
|
||||
return s.indexer.Index(ar.Id, strings.ToLower(ar.Name))
|
||||
func (s search) ClearAll() error {
|
||||
return s.indexer.Clear()
|
||||
}
|
||||
|
||||
func (s search) IndexArtist(ar *domain.Artist) error {
|
||||
return s.indexer.Index("ar-"+ar.Id, strings.ToLower(ar.Name))
|
||||
}
|
||||
|
||||
func (s search) IndexAlbum(al *domain.Album) error {
|
||||
return s.indexer.Index("al-"+al.Id, strings.ToLower(al.Name))
|
||||
}
|
||||
|
||||
func (s search) IndexMediaFile(mf *domain.MediaFile) error {
|
||||
return s.indexer.Index("mf-"+mf.Id, strings.ToLower(mf.Title))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user