Update scalafmt settings

This commit is contained in:
eikek
2021-09-22 17:23:24 +02:00
parent c37f1d7c31
commit 9013f2de5b
277 changed files with 1579 additions and 1615 deletions

View File

@ -20,19 +20,19 @@ object Field {
def apply(name: String): Field =
new Field(name)
val id = Field("id")
val itemId = Field("itemId")
val collectiveId = Field("collectiveId")
val attachmentId = Field("attachmentId")
val discriminator = Field("discriminator")
val id = Field("id")
val itemId = Field("itemId")
val collectiveId = Field("collectiveId")
val attachmentId = Field("attachmentId")
val discriminator = Field("discriminator")
val attachmentName = Field("attachmentName")
val content = Field("content")
val content_de = contentField(Language.German)
val content_en = contentField(Language.English)
val content_fr = contentField(Language.French)
val itemName = Field("itemName")
val itemNotes = Field("itemNotes")
val folderId = Field("folder")
val content = Field("content")
val content_de = contentField(Language.German)
val content_en = contentField(Language.English)
val content_fr = contentField(Language.French)
val itemName = Field("itemName")
val itemNotes = Field("itemNotes")
val folderId = Field("folder")
val contentLangFields = Language.all
.map(contentField)

View File

@ -77,7 +77,7 @@ trait JsonCodec {
new Decoder[VersionDoc] {
final def apply(c: HCursor): Decoder.Result[VersionDoc] =
for {
id <- c.get[String](VersionDoc.Fields.id.name)
id <- c.get[String](VersionDoc.Fields.id.name)
version <- c.get[Int](VersionDoc.Fields.currentVersion.name)
} yield VersionDoc(id, version)
}
@ -106,10 +106,10 @@ trait JsonCodec {
new Decoder[FtsResult] {
final def apply(c: HCursor): Decoder.Result[FtsResult] =
for {
qtime <- c.downField("responseHeader").get[Duration]("QTime")
count <- c.downField("response").get[Int]("numFound")
maxScore <- c.downField("response").get[Double]("maxScore")
results <- c.downField("response").get[List[FtsResult.ItemMatch]]("docs")
qtime <- c.downField("responseHeader").get[Duration]("QTime")
count <- c.downField("response").get[Int]("numFound")
maxScore <- c.downField("response").get[Double]("maxScore")
results <- c.downField("response").get[List[FtsResult.ItemMatch]]("docs")
highlightng <- c.get[Map[Ident, Map[String, List[String]]]]("highlighting")
highlight = highlightng.map(kv => kv._1 -> kv._2.values.flatten.toList)
} yield FtsResult(qtime, count, maxScore, highlight, results)
@ -120,10 +120,10 @@ trait JsonCodec {
final def apply(c: HCursor): Decoder.Result[FtsResult.ItemMatch] =
for {
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)
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)
}
@ -135,7 +135,7 @@ trait JsonCodec {
md <-
if ("attachment" == disc)
for {
aId <- c.get[Ident](Field.attachmentId.name)
aId <- c.get[Ident](Field.attachmentId.name)
aName <- c.get[String](Field.attachmentName.name)
} yield FtsResult.AttachmentData(aId, aName)
else Right(FtsResult.ItemData)

View File

@ -26,11 +26,11 @@ final case class QueryData(
def withHighLight(fields: List[Field], pre: String, post: String): QueryData =
copy(params =
params ++ Map(
"hl" -> "on",
"hl" -> "on",
"hl.requireFieldMatch" -> "true",
"hl.fl" -> fields.map(_.name).mkString(","),
"hl.simple.pre" -> pre,
"hl.simple.post" -> post
"hl.fl" -> fields.map(_.name).mkString(","),
"hl.simple.pre" -> pre,
"hl.simple.post" -> post
)
)
}
@ -46,9 +46,9 @@ object QueryData {
fields: List[Field],
fq: FtsQuery
): QueryData = {
val q = sanitize(fq.q)
val extQ = search.map(f => s"${f.name}:($q)").mkString(" OR ")
val items = fq.items.map(_.id).mkString(" ")
val q = sanitize(fq.q)
val extQ = search.map(f => s"${f.name}:($q)").mkString(" OR ")
val items = fq.items.map(_.id).mkString(" ")
val folders = fq.folders.map(_.id).mkString(" ")
val filterQ = List(
s"""${Field.collectiveId.name}:"${fq.collective.id}"""",

View File

@ -53,9 +53,9 @@ final class SolrFtsClient[F[_]: Async](
f: List[TextData] => F[Unit]
): F[Unit] =
(for {
_ <- Stream.eval(logger.debug("Updating SOLR index"))
_ <- Stream.eval(logger.debug("Updating SOLR index"))
chunks <- data.chunks
res <- Stream.eval(f(chunks.toList).attempt)
res <- Stream.eval(f(chunks.toList).attempt)
_ <- res match {
case Right(()) => Stream.emit(())
case Left(ex) =>

View File

@ -69,7 +69,7 @@ object SolrQuery {
Field("current_version_i")
)
val query = QueryData(s"id:$id", "", 1, 0, fields, Map.empty)
val req = Method.POST(query.asJson, url)
val req = Method.POST(query.asJson, url)
client.expect[Option[VersionDoc]](req)
}
}

View File

@ -60,8 +60,8 @@ object SolrSetup {
val verDoc = VersionDoc(versionDocId, allMigrations.map(_.value.version).max)
val solrUp = SolrUpdate(cfg, client)
val writeVersion = SolrMigration.writeVersion(solrUp, verDoc)
val deleteAll = SolrMigration.deleteData(0, solrUp)
val indexAll = SolrMigration.indexAll[F](Int.MaxValue, "Index all data")
val deleteAll = SolrMigration.deleteData(0, solrUp)
val indexAll = SolrMigration.indexAll[F](Int.MaxValue, "Index all data")
deleteAll :: (allMigrations
.filter(_.isSchemaChange) ::: List(indexAll, writeVersion))

View File

@ -79,7 +79,7 @@ object SolrUpdate {
for {
docIds <- client.expect[DocIdResult](searchReq)
sets = docIds.toSetFolder(folder)
req = Method.POST(sets.asJson, url)
req = Method.POST(sets.asJson, url)
_ <- client.expect[Unit](req)
} yield ()
}

View File

@ -11,7 +11,7 @@ final case class VersionDoc(id: String, currentVersion: Int)
object VersionDoc {
object Fields {
val id = Field("id")
val id = Field("id")
val currentVersion = Field("current_version_i")
}
}