Skip to content

Commit d67ae87

Browse files
committed
Merge branch 'rpb-266-spatialData' of https://github.com/hbz/rpb into main
Resolves https://jira.hbz-nrw.de/browse/RPB-266
2 parents c1c5205 + d343d35 commit d67ae87

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

app/controllers/nwbib/Application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public static Result classification(final String t) {
401401
}
402402
result = classificationResult(t, placeholder);
403403
}
404-
Cache.set("classification." + t, result, ONE_DAY);
404+
Cache.set("classification." + t, result);
405405
return result;
406406
}
407407

app/controllers/nwbib/Classification.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
*/
7474
public class Classification {
7575

76+
private static final int MAX_RESULT_WINDOW = 15000;
7677
private static final String RPB_SPATIAL = "https://rpb.lobid.org/spatial#";
7778
private static final String INDEX = "rpb";
7879

@@ -164,11 +165,10 @@ public JsonNode buildRegister() {
164165
}
165166

166167
private SearchResponse classificationData() {
167-
int maxSize = 10000; // default max_result_window
168168
MatchAllQueryBuilder matchAll = QueryBuilders.matchAllQuery();
169169
SearchRequestBuilder requestBuilder = client.prepareSearch(INDEX)
170170
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(matchAll)
171-
.setTypes(elasticsearchType).setFrom(0).setSize(maxSize);
171+
.setTypes(elasticsearchType).setFrom(0).setSize(MAX_RESULT_WINDOW);
172172
return requestBuilder.execute().actionGet();
173173
}
174174
}
@@ -492,6 +492,7 @@ public static void indexStartup() {
492492
.put("path.home", new File(".").getAbsolutePath())//
493493
.put("http.port", httpPort)//
494494
.put("transport.tcp.port", tcpPort)//
495+
.put("cluster.routing.allocation.disk.threshold_enabled", false)//
495496
.build(), Arrays.asList(Netty4Plugin.class));
496497
try {
497498
node.start();
@@ -506,6 +507,8 @@ public static void indexStartup() {
506507
indexData(CONFIG.getString("index.data.rpbsubject"), Type.NWBIB);
507508
indexData(CONFIG.getString("index.data.rpbspatial"), Type.SPATIAL);
508509
client.admin().indices().refresh(new RefreshRequest()).actionGet();
510+
Settings indexSettings = Settings.builder().put("max_result_window", MAX_RESULT_WINDOW).build();
511+
client.admin().indices().prepareUpdateSettings().setSettings(indexSettings).setIndices(INDEX).get();
509512
}
510513
}
511514

app/controllers/nwbib/Lobid.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,7 @@ public static long getTotalHitsNwbibClassification(String value) {
222222
initAggregation("spatial.id");
223223
initAggregation("subject.id");
224224
}
225-
return AGGREGATION_COUNT.containsKey(value)
226-
? AGGREGATION_COUNT.getOrDefault(value, 0L) : lobidRequest(value);
227-
}
228-
229-
private static Long lobidRequest(String value) {
230-
return request("", "", "", "", "", "", "", "", value, "", 0, 1, "", "", "",
231-
"", "", "", "").get().map((WSResponse response) -> {
232-
return getTotalResults(response.asJson());
233-
}).get(Lobid.API_TIMEOUT);
225+
return AGGREGATION_COUNT.getOrDefault(value, 0L);
234226
}
235227

236228
private static void initAggregation(String field) {

0 commit comments

Comments
 (0)