Update search index when refreshing albums/artists
This commit is contained in:
parent
cef65b6ab0
commit
5dbe71d675
3 changed files with 9 additions and 1 deletions
|
|
@ -123,6 +123,10 @@ group by album_id order by f.id`, strings.Join(ids, "','"))
|
||||||
} else {
|
} else {
|
||||||
toInsert = append(toInsert, al.album)
|
toInsert = append(toInsert, al.album)
|
||||||
}
|
}
|
||||||
|
err := r.addToIndex(o, r.tableName, al.ID, al.Name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(toInsert) > 0 {
|
if len(toInsert) > 0 {
|
||||||
n, err := o.InsertMulti(100, toInsert)
|
n, err := o.InsertMulti(100, toInsert)
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,10 @@ where f.artist_id in ('%s') group by f.artist_id order by f.id`, strings.Join(id
|
||||||
} else {
|
} else {
|
||||||
toInsert = append(toInsert, ar.artist)
|
toInsert = append(toInsert, ar.artist)
|
||||||
}
|
}
|
||||||
|
err := r.addToIndex(o, r.tableName, ar.ID, ar.Name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(toInsert) > 0 {
|
if len(toInsert) > 0 {
|
||||||
n, err := o.InsertMulti(100, toInsert)
|
n, err := o.InsertMulti(100, toInsert)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
type Search struct {
|
type Search struct {
|
||||||
ID string `orm:"pk;column(id)"`
|
ID string `orm:"pk;column(id)"`
|
||||||
Table string `orm:"index"`
|
Table string `orm:"index"`
|
||||||
FullText string `orm:"type(text)"`
|
FullText string `orm:"index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type searchableRepository struct {
|
type searchableRepository struct {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue