mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
BUGFIX: FTS5 items table & desync with places (query with name LIKE "[%")
This commit is contained in:
@@ -66,7 +66,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
placesmap = datatypes.MakeMap(places, func(record *dbmodels.Place) string { return record.Name() })
|
placesmap = datatypes.MakeMap(places, func(record *dbmodels.Place) string { return record.Name() })
|
||||||
placesmapid = datatypes.MakeMap(places, func(record *dbmodels.Place) string { return record.Id })
|
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -103,15 +102,16 @@ func init() {
|
|||||||
wg.Add(2)
|
wg.Add(2)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if records, err := seed.ItemsFromBändeAndBIBLIO(app, adb.Bände, adb.BIBLIO, entriesmap); err == nil {
|
records, err := seed.ItemsFromBändeAndBIBLIO(app, adb.Bände, adb.BIBLIO, entriesmap)
|
||||||
for _, record := range records {
|
if err != nil {
|
||||||
if err = app.Save(record); err != nil {
|
|
||||||
app.Logger().Error("Error saving record", "error", err, "record", record)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
for _, record := range records {
|
||||||
|
if err = app.Save(record); err != nil {
|
||||||
|
app.Logger().Error("Error saving record", "error", err, "record", record)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items = records
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -183,6 +183,15 @@ func init() {
|
|||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
|
// INFO: We need to get places again, sice it has changed in entries
|
||||||
|
places := []*dbmodels.Place{}
|
||||||
|
err = app.RecordQuery(dbmodels.PLACES_TABLE).All(&places)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
placesmapid = datatypes.MakeMap(places, func(record *dbmodels.Place) string { return record.Id })
|
||||||
|
|
||||||
// INFO: Inserting FTS5 data
|
// INFO: Inserting FTS5 data
|
||||||
qp := dbmodels.FTS5InsertQuery(app, dbmodels.PLACES_TABLE, dbmodels.PLACES_FTS5_FIELDS)
|
qp := dbmodels.FTS5InsertQuery(app, dbmodels.PLACES_TABLE, dbmodels.PLACES_FTS5_FIELDS)
|
||||||
qa := dbmodels.FTS5InsertQuery(app, dbmodels.AGENTS_TABLE, dbmodels.AGENTS_FTS5_FIELDS)
|
qa := dbmodels.FTS5InsertQuery(app, dbmodels.AGENTS_TABLE, dbmodels.AGENTS_FTS5_FIELDS)
|
||||||
@@ -191,7 +200,7 @@ func init() {
|
|||||||
qe := dbmodels.FTS5InsertQuery(app, dbmodels.ENTRIES_TABLE, dbmodels.ENTRIES_FTS5_FIELDS)
|
qe := dbmodels.FTS5InsertQuery(app, dbmodels.ENTRIES_TABLE, dbmodels.ENTRIES_FTS5_FIELDS)
|
||||||
qc := dbmodels.FTS5InsertQuery(app, dbmodels.CONTENTS_TABLE, dbmodels.CONTENTS_FTS5_FIELDS)
|
qc := dbmodels.FTS5InsertQuery(app, dbmodels.CONTENTS_TABLE, dbmodels.CONTENTS_FTS5_FIELDS)
|
||||||
|
|
||||||
for _, place := range placesmap {
|
for _, place := range places {
|
||||||
if err = dbmodels.BulkInsertFTS5Place(qp, place); err != nil {
|
if err = dbmodels.BulkInsertFTS5Place(qp, place); err != nil {
|
||||||
app.Logger().Error("Error inserting place", "error", err, "place", place)
|
app.Logger().Error("Error inserting place", "error", err, "place", place)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user