Removing purged ids from the search index

This commit is contained in:
Deluan
2016-03-18 19:50:21 -04:00
parent 3790aa45e4
commit 508bf7152f
12 changed files with 44 additions and 22 deletions
+16
View File
@@ -17,6 +17,10 @@ type Search interface {
IndexAlbum(al *domain.Album) error
IndexMediaFile(mf *domain.MediaFile) error
RemoveArtist(ids []string) error
RemoveAlbum(ids []string) error
RemoveMediaFile(ids []string) error
SearchArtist(q string, offset int, size int) (Results, error)
SearchAlbum(q string, offset int, size int) (Results, error)
SearchSong(q string, offset int, size int) (Results, error)
@@ -63,6 +67,18 @@ func (s search) IndexMediaFile(mf *domain.MediaFile) error {
return s.idxSong.Index(mf.Id, sanitize.Accents(strings.ToLower(mf.Title)))
}
func (s search) RemoveArtist(ids []string) error {
return s.idxArtist.Remove(ids...)
}
func (s search) RemoveAlbum(ids []string) error {
return s.idxAlbum.Remove(ids...)
}
func (s search) RemoveMediaFile(ids []string) error {
return s.idxSong.Remove(ids...)
}
func (s search) SearchArtist(q string, offset int, size int) (Results, error) {
q = sanitize.Accents(strings.ToLower(strings.TrimSuffix(q, "*")))
min := offset