Cleanup + hiding false errors from log

This commit is contained in:
Eike Kettner 2020-06-24 00:23:22 +02:00
parent 30937d4908
commit 7d7460b1c9
4 changed files with 15 additions and 8 deletions

View File

@ -65,9 +65,9 @@ trait JsonCodec {
new Decoder[FtsResult.ItemMatch] {
final def apply(c: HCursor): Decoder.Result[FtsResult.ItemMatch] =
for {
itemId <- c.get[Ident]("itemId")
id <- c.get[Ident]("id")
coll <- c.get[Ident]("collectiveId")
itemId <- c.get[Ident](Field.itemId.name)
id <- c.get[Ident](Field.id.name)
coll <- c.get[Ident](Field.collectiveId.name)
score <- c.get[Double]("score")
md <- decodeMatchData(c)
} yield FtsResult.ItemMatch(id, itemId, coll, score, md)

View File

@ -173,10 +173,9 @@ trait Conversions {
ItemLightList(gs)
}
def mkItemListWithTagsFtsPlain(v: Vector[OFulltext.FtsItemWithTags]): ItemLightList = {
def mkItemListWithTagsFtsPlain(v: Vector[OFulltext.FtsItemWithTags]): ItemLightList =
if (v.isEmpty) ItemLightList(Nil)
else ItemLightList(List(ItemLightGroup("Results", v.map(mkItemLightWithTags).toList)))
}
def mkItemLight(i: OItemSearch.ListItem): ItemLight =
ItemLight(

View File

@ -214,7 +214,11 @@ object QItem {
Batch(0, c)
}
private def findItemsBase(q: Query, distinct: Boolean, ctes: (String, Fragment)*): Fragment = {
private def findItemsBase(
q: Query,
distinct: Boolean,
ctes: (String, Fragment)*
): Fragment = {
val IC = RItem.Columns
val AC = RAttachment.Columns
val PC = RPerson.Columns
@ -389,7 +393,11 @@ object QItem {
.map(it => fr"(${it.itemId}, ${it.weight})")
.reduce((r, e) => r ++ fr"," ++ e)
val from = findItemsBase(q, false, ("tids(item_id, weight)", fr"(VALUES" ++ values ++ fr")")) ++
val from = findItemsBase(
q,
false,
("tids(item_id, weight)", fr"(VALUES" ++ values ++ fr")")
) ++
fr"INNER JOIN tids ON" ++ IC.id.prefix("i").f ++ fr" = tids.item_id" ++
fr"ORDER BY tids.weight DESC"

View File

@ -46,7 +46,7 @@ object RFtsMigration {
table,
all,
fr"${v.id},${v.version},${v.ftsEngine},${v.description},${v.created}"
).update.run
).updateWithLogHandler(LogHandler.nop).run
def exists(vers: Int, engine: Ident): ConnectionIO[Boolean] =
selectCount(id, table, and(version.is(vers), ftsEngine.is(engine)))