From 084f5d91e489f03eef29031b7a33d8254ef144b5 Mon Sep 17 00:00:00 2001 From: Thomas Krause Date: Wed, 13 Mar 2024 10:40:41 +0100 Subject: [PATCH 1/2] Update to graphANNIS 3.2.0 --- CHANGELOG.md | 4 ++++ pom.xml | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eea44fd50..3625c7dee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Avoid null pointer exceptions when merging corpus configs for search options. +- Updated to graphANNIS 3.2.0 which contains several performance improvements + for working with large corpora (>10 million token). You might have to + re-import the corpora to get the full performance improvement, because a new + graph storage implementation and statistics have been added. ## [4.11.0] - 2024-02-09 diff --git a/pom.xml b/pom.xml index b05f9815ab..edb213bdb0 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 8.14.3 true org.corpus_tools.annis.gui.AnnisUiApplication - 3.1.1 + 3.2.0 4.7.2 server 1.5.24 @@ -261,7 +261,7 @@ https://github.com/korpling/graphANNIS/releases/download/v${graphannis.version}/graphannis-webservice-x86_64-unknown-linux-gnu.tar.xz ${project.build.directory}/native/ - 8c1265d164d919c998773bb6aa095ac5f931182d0c2f6296e860cbfecd1dc58c + a22a26f2af3e3c9971a2f657ef41a20ae8759f1572a57ab2a5ad7b55940dc1b9 true @@ -276,7 +276,7 @@ https://github.com/korpling/graphANNIS/releases/download/v${graphannis.version}/graphannis-webservice-x86_64-pc-windows-msvc.zip ${project.build.directory}/native/win32-x86-64/ - 1d4b583bca79633d307673288295ec2eae70539ce145ba619f055792f2f874af + 9d5eb40fa008d8228260a91cadf5eeee372ff85b6acd416df55f96b475a1f874 true @@ -291,7 +291,7 @@ https://github.com/korpling/graphANNIS/releases/download/v${graphannis.version}/graphannis-webservice-x86_64-apple-darwin.tar.xz ${project.build.directory}/native/ - f1b56d73069546f2e55542a4bf6aba6dfeac179a8c6d17fbd736450d602eb72e + a2c0741409c381930a7cb566465fa8ba29343f5654cfe8db91fa1f7e56fdd9e4 true From d35e519e8b6566e3cbb512a76bf838521592455b Mon Sep 17 00:00:00 2001 From: Thomas Krause Date: Wed, 13 Mar 2024 11:07:39 +0100 Subject: [PATCH 2/2] Omit the document count if there are no documents --- CHANGELOG.md | 12 +++++-- .../annis/gui/controller/CountCallback.java | 33 +++++++++++-------- .../corpus_tools/annis/gui/AnnisUITest.java | 4 +-- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3625c7dee3..af7b34206a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] + ### Fixed -- Avoid null pointer exceptions when merging corpus configs for search - options. +- Do not add "annis:doc" labels to sub-corpora when importing relANNIS corpora. + This will fix queries where you just search for documents, e.g. by `annis:doc` + but previously also got the sub-corpora as result. This bug only occurred in + corpora with sub-corpora and for the document searches. +- Avoid null pointer exceptions when merging corpus configs for search options. - Updated to graphANNIS 3.2.0 which contains several performance improvements for working with large corpora (>10 million token). You might have to re-import the corpora to get the full performance improvement, because a new graph storage implementation and statistics have been added. +- Omit the document count for results where there are no matches inside a + document, but only the documents or sub-corpora themselves. A document count + of 0 would otherwise be very confusing. + ## [4.11.0] - 2024-02-09 diff --git a/src/main/java/org/corpus_tools/annis/gui/controller/CountCallback.java b/src/main/java/org/corpus_tools/annis/gui/controller/CountCallback.java index 02e11d90ab..ae0a1b7843 100644 --- a/src/main/java/org/corpus_tools/annis/gui/controller/CountCallback.java +++ b/src/main/java/org/corpus_tools/annis/gui/controller/CountCallback.java @@ -51,21 +51,26 @@ public void onFailure(ApiException e, int statusCode, @Override public void onSuccess(CountExtra result, int statusCode, - Map> responseHeaders) { - ui.access(() -> { - ui.getQueryState().getExecutedTasks().remove(QueryUIState.QueryType.COUNT); + Map> responseHeaders) { + ui.access(() -> { + ui.getQueryState().getExecutedTasks().remove(QueryUIState.QueryType.COUNT); - String documentString = result.getDocumentCount() > 1 ? "documents" : "document"; - String matchesString = result.getMatchCount() > 1 ? "matches" : "match"; - ui.getSearchView().getControlPanel().getQueryPanel() - .setStatus("" + result.getMatchCount() + " " + matchesString + "\nin " - + result.getDocumentCount() + " " + documentString); - if (result.getMatchCount() > 0 && panel != null) { - panel.getPaging().setPageSize(pageSize, false); - panel.setCount(result.getMatchCount()); - } - ui.getSearchView().getControlPanel().getQueryPanel().setCountIndicatorEnabled(false); - }); + // Decide whether to use plural + String documentString = result.getDocumentCount() > 1 ? "documents" : "document"; + String matchesString = result.getMatchCount() > 1 ? "matches" : "match"; + // Construct the whole string, but omit the document count if it is zero (e.g. because + // there are only sub-corpus or document matches and no matches inside a document) + String completeString = + result.getDocumentCount() == 0 ? "" + result.getMatchCount() + " " + matchesString + : "" + result.getMatchCount() + " " + matchesString + "\nin " + + result.getDocumentCount() + " " + documentString; + ui.getSearchView().getControlPanel().getQueryPanel().setStatus(completeString); + if (result.getMatchCount() > 0 && panel != null) { + panel.getPaging().setPageSize(pageSize, false); + panel.setCount(result.getMatchCount()); + } + ui.getSearchView().getControlPanel().getQueryPanel().setCountIndicatorEnabled(false); + }); } @Override diff --git a/src/test/java/org/corpus_tools/annis/gui/AnnisUITest.java b/src/test/java/org/corpus_tools/annis/gui/AnnisUITest.java index 83aab1cd93..516f808250 100644 --- a/src/test/java/org/corpus_tools/annis/gui/AnnisUITest.java +++ b/src/test/java/org/corpus_tools/annis/gui/AnnisUITest.java @@ -354,7 +354,7 @@ void searchPccDocumentMatches() throws Exception { _click(searchButton); // Wait until the count is displayed - String expectedStatus = "2 matches\nin 2 documents"; + String expectedStatus = "2 matches"; awaitCondition(60, () -> expectedStatus .equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()), @@ -392,7 +392,7 @@ void searchPccCorpusMatches() throws Exception { Thread.sleep(500); // Wait until the count is displayed - String expectedStatus = "1 match\nin 1 document"; + String expectedStatus = "1 match"; awaitCondition(60, () -> expectedStatus .equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()),