Skip to content

Commit efbb754

Browse files
committed
Keep rewrites in Meta (fixes #188)
Change-Id: I0eaf2663acdb57c9936fa60630523677c1e51993
1 parent 05ba9f5 commit efbb754

File tree

5 files changed

+32
-2
lines changed

5 files changed

+32
-2
lines changed

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
0.64.2 2025-06-18
2+
- [bugfix] Restore rewrites in Meta. (diewald)
3+
14
0.64.1 2025-05-26
25
- [bugfix] Ignore line endings in indexer tests. (diewald)
36
- [bugfix] Correctly cleanup test directories. (diewald)

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
<groupId>de.ids-mannheim.korap.krill</groupId>
3737
<artifactId>Krill</artifactId>
38-
<version>0.64.1</version>
38+
<version>0.64.2</version>
3939
<packaging>jar</packaging>
4040

4141
<name>Krill</name>

src/main/java/de/ids_mannheim/korap/KrillMeta.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public final class KrillMeta extends Notifications {
3434
private ArrayList<String> fields;
3535
HashSet<Integer> highlights;
3636

37+
private JsonNode rewrites;
38+
3739
// Timeout search after milliseconds
3840
private long timeout = (long) 120_000;
3941
// private long timeoutStart = Long.MIN_VALUE;
@@ -160,6 +162,9 @@ public KrillMeta fromJson (JsonNode json) {
160162
if (json.has("context"))
161163
this.context.fromJson(json.get("context"));
162164

165+
if (json.has("rewrites"))
166+
this.rewrites = json.get("rewrites");
167+
163168
// Defined highlights
164169
if (json.has("highlight")) {
165170

@@ -270,6 +275,11 @@ public SearchContext getContext () {
270275
};
271276

272277

278+
public JsonNode getRewrites () {
279+
return this.rewrites;
280+
};
281+
282+
273283
public KrillMeta setContext (SearchContext context) {
274284
this.context = context;
275285
return this;
@@ -424,6 +434,9 @@ public JsonNode toJsonNode () {
424434
json.set("highlight", highlightNode);
425435
};
426436

437+
if (this.getRewrites() != null)
438+
json.set("rewrites", this.getRewrites());
439+
427440
return json;
428441
};
429442
};

src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ public void searchMetaFieldsNew () throws IOException {
151151
assertEquals("match-GOE_AGX.00002-p7-8",
152152
res.at("/matches/0/matchID").asText());
153153

154+
assertFalse(res.at("/meta/rewrites").isMissingNode());
155+
assertEquals("Kustvakt", res.at("/meta/rewrites/0/src").asText());
156+
157+
154158
// All fields
155159
jsonString = getJsonString(getClass()
156160
.getResource("/queries/metas/fields_all.jsonld").getFile());
@@ -182,6 +186,7 @@ public void searchMetaFieldsNew () throws IOException {
182186
// assertEquals("372-377", res.at("/matches/0/pages").asText());
183187
assertEquals("match-GOE_AGX.00002-p7-8",
184188
res.at("/matches/0/matchID").asText());
189+
assertTrue(res.at("/meta/rewrites").isMissingNode());
185190

186191

187192
// @All fields

src/test/resources/queries/metas/fields_no.jsonld

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
"announcements" : [],
44
"errors" : [],
55
"meta" : {
6-
"count":9
6+
"count":9,
7+
"rewrites":[
8+
{
9+
"@type" : "koral:rewrite",
10+
"src" : "Kustvakt",
11+
"origin" : "Kustvakt",
12+
"scope" : "count",
13+
"source" : 10
14+
}
15+
]
716
},
817
"query" : {
918
"@type" : "koral:token",

0 commit comments

Comments
 (0)