Skip to content

Commit eb8c02b

Browse files
committed
Don't allow colliding flat meta values
Change-Id: Id280934f813a67eff3dd2a1ba84a1b876906910d
1 parent 74563e1 commit eb8c02b

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/main/java/de/ids_mannheim/korap/response/Match.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -2494,11 +2494,11 @@ public JsonNode toJsonNode () {
24942494
// Legacy flat field support
24952495
String mfs = mf.key;
24962496
String value = this.getFieldValue(mfs);
2497-
if (value != null)
2497+
if (value != null && !json.has(mfs))
24982498
json.set(mfs, new TextNode(value));
24992499
};
25002500

2501-
this.addMessage(0, "Support for flat field values is eprecated");
2501+
this.addMessage(0, "Support for flat field values is deprecated");
25022502

25032503
return json;
25042504
};

src/main/java/de/ids_mannheim/korap/response/Text.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public String toJsonString () {
5555
// Legacy flat field support
5656
String mfs = mf.key;
5757
String value = this.getFieldValue(mfs);
58-
if (value != null)
58+
if (value != null && !json.has(mfs))
5959
json.set(mfs, new TextNode(value));
6060
};
6161

62-
this.addMessage(0, "Support for flat field values is eprecated");
62+
this.addMessage(0, "Support for flat field values is deprecated");
6363

6464

6565
// Match was no match

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ public void searchMetaFieldsNew () throws IOException {
151151
assertEquals("match-GOE_AGX.00002-p7-8",
152152
res.at("/matches/0/matchID").asText());
153153

154-
155154
// All fields
156155
jsonString = getJsonString(getClass()
157156
.getResource("/queries/metas/fields_all.jsonld").getFile());
@@ -213,7 +212,7 @@ public void searchMetaFieldsNew () throws IOException {
213212
assertEquals("Goethe: Maximen und Reflexionen, (1827-1842)",
214213
res.at("/matches/0/docTitle").asText());
215214
assertEquals("1827", res.at("/matches/0/creationDate").asText());
216-
// assertEquals("372-377", res.at("/matches/0/pages").asText());
215+
assertTrue(res.at("/matches/0/pages").isMissingNode());
217216
assertEquals("match-GOE_AGX.00002-p7-8",
218217
res.at("/matches/0/matchID").asText());
219218

0 commit comments

Comments
 (0)