diff --git a/config.yml b/config.yml index 008b6ac..8f407df 100644 --- a/config.yml +++ b/config.yml @@ -26,7 +26,7 @@ logging: archivedLogFilenamePattern: ./query-log-%d.gz archivedFileCount: 5 timeZone: UTC - logFormat: "%d{ISO8601,UTC}|%m%n" + logFormat: "%d{ISO8601,UTC}|%m|%kvp%n" bufferSize: 256KiB immediateFlush: true filterFactories: @@ -46,7 +46,6 @@ projects: - name: 'globalise' textType: LogicalText annoRepo: - apiKey: 02d01d02-be58-4e9e-95c2-387715996bb5 containerName: globalise-2024-03-18 uri: https://annorepo.globalise.huygens.knaw.nl brinta: @@ -67,7 +66,6 @@ projects: path: "$.body.metadata.document" type: keyword textRepo: - apiKey: YnJhbWI6MmMxNmNmNDQtYjcxZC0xMWVjLTgxZmUtOGYyZWJkZjU1Nzdl uri: https://globalise.tt.di.huc.knaw.nl - name: 'mondriaan' @@ -162,30 +160,18 @@ projects: deleteKey: 'republic-dev-mag-weg' joinSeparator: " " indices: - - name: 'republic-2024.05.17' - bodyTypes: [ Resolution, Entity, AttendanceList ] + - name: 'republic-2024.06.18' + bodyTypes: [ Resolution ] fields: - - name: bodyType - path: "$.body.type" - type: keyword - - name: entityCategory - path: "$.body.metadata.category" - type: keyword - - name: entityId - path: "$.body.metadata.entityId" - type: keyword - - name: entityLabels - path: "$.body.metadata.entityLabels" - type: keyword - - name: entityName - path: "$.body.metadata.name" - type: keyword - name: propositionType path: "$.body.metadata.propositionType" type: keyword - name: resolutionType path: "$.body.metadata.resolutionType" type: keyword + - name: textType + path: "$.body.metadata.textType" + type: keyword - name: sessionDate path: "$.body.metadata.sessionDate" type: date @@ -198,19 +184,36 @@ projects: - name: sessionYear path: "$.body.metadata.sessionYear" type: short + - name: delegateId + path: "$.body.metadata.delegateId" + type: keyword + - name: delegateName + path: "$.body.metadata.delegateName" + type: keyword + - name: entityCategory + path: "$.body.metadata.category" + type: keyword + - name: entityId + path: "$.body.metadata.entityId" + type: keyword + - name: entityLabels + path: "$.body.metadata.entityLabels" + type: keyword + - name: entityName + path: "$.body.metadata.name" + type: keyword + - name: bodyType + path: "$.body.type" + type: keyword - name: sessionWeekday path: "$.body.metadata.sessionWeekday" type: keyword - - name: textType - path: "$.body.metadata.textType" - type: keyword annoRepo: - containerName: republic-2024.05.17 + containerName: republic-2024.06.18 uri: https://annorepo.republic-caf.diginfra.org textRepo: uri: https://textrepo.republic-caf.diginfra.org - - name: 'suriano' topTierBodyType: tf:File brinta: @@ -262,7 +265,6 @@ projects: path: "$.body.type" type: keyword textRepo: - apiKey: cHJveWNvbjo5Y2I2YTIyZS1jY2M5LTExZWUtYTllZS0zMzNmNDQ2YjBjZTE= uri: https://brieven-van-hooft.tt.di.huc.knaw.nl - name: 'vangogh' diff --git a/pom.xml b/pom.xml index fa01da1..e5ea142 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ nl.knaw.huc broccoli - 0.35.2 + 0.35.3 jar @@ -104,8 +104,10 @@ true - - + + ${mainClass} @@ -142,8 +144,10 @@ - - + + ${mainClass} diff --git a/src/main/kotlin/nl/knaw/huc/broccoli/api/IndexQuery.kt b/src/main/kotlin/nl/knaw/huc/broccoli/api/IndexQuery.kt index 476c5b5..db94d01 100644 --- a/src/main/kotlin/nl/knaw/huc/broccoli/api/IndexQuery.kt +++ b/src/main/kotlin/nl/knaw/huc/broccoli/api/IndexQuery.kt @@ -10,12 +10,17 @@ data class IndexQuery( @JsonProperty("aggs") val aggregations: List? = null -) +) { + override fun toString(): String = buildString { + text?.let { append(it).append('|') } + date?.let { append(it).append('|') } + range?.let { append(it).append('|') } + terms?.let { append(it).append('|') } + } +} typealias IndexTerms = Map> -data class IndexRange( - val name: String, - val from: String?, - val to: String? -) +data class IndexRange(val name: String, val from: String?, val to: String?) { + override fun toString(): String = "$name:[$from,$to]" +} diff --git a/src/main/kotlin/nl/knaw/huc/broccoli/resources/projects/ProjectsResource.kt b/src/main/kotlin/nl/knaw/huc/broccoli/resources/projects/ProjectsResource.kt index 7507f56..d8ed396 100644 --- a/src/main/kotlin/nl/knaw/huc/broccoli/resources/projects/ProjectsResource.kt +++ b/src/main/kotlin/nl/knaw/huc/broccoli/resources/projects/ProjectsResource.kt @@ -99,7 +99,7 @@ class ProjectsResource( find { it == sortBy } ?: throw BadRequestException("query param sortBy must be one of ${this.sorted()}") } - logQuery(queryString) + logQuery(queryString, from, size) val queryBuilder = ElasticQueryBuilder(index) .query(queryString) @@ -169,11 +169,11 @@ class ProjectsResource( } } - private fun logQuery(query: IndexQuery) { + private fun logQuery(query: IndexQuery, from: Int, size: Int) { if (query.text != null) { logger.atDebug() .addMarker(queryMarker) - .setMessage(jsonWriter.writeValueAsString(query.text)) + .setMessage("${query}from=$from|size=$size") .log() } }