From 332c34d2125ffbfac5521881d5f054900dd05e00 Mon Sep 17 00:00:00 2001 From: awildturtok <1553491+awildturtok@users.noreply.github.com> Date: Thu, 9 Mar 2023 18:05:54 +0100 Subject: [PATCH] appeases the java type system demons --- .../com/bakdata/conquery/models/datasets/Column.java | 2 +- .../conquery/models/datasets/concepts/Searchable.java | 2 +- .../concepts/filters/specific/SelectFilter.java | 4 ++-- .../conquery/models/jobs/UpdateFilterSearchJob.java | 10 +++++----- .../bakdata/conquery/models/query/FilterSearch.java | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/src/main/java/com/bakdata/conquery/models/datasets/Column.java b/backend/src/main/java/com/bakdata/conquery/models/datasets/Column.java index b46612e72f..c3f6c59b4e 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/datasets/Column.java +++ b/backend/src/main/java/com/bakdata/conquery/models/datasets/Column.java @@ -170,7 +170,7 @@ public List> getSearches(IndexConfig config, Namespace } @Override - public List getSearchReferences() { + public List> getSearchReferences() { return List.of(this); } diff --git a/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/Searchable.java b/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/Searchable.java index 10b8090f1b..1047c74a4c 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/Searchable.java +++ b/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/Searchable.java @@ -34,7 +34,7 @@ public interface Searchable>> * @implSpec The order of objects returned is used to also sort search results from different sources. */ @JsonIgnore - default List getSearchReferences() { + default List> getSearchReferences() { //Hopefully the only candidate will be Column return List.of(this); } diff --git a/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/filters/specific/SelectFilter.java b/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/filters/specific/SelectFilter.java index 531ec32c4b..e8f06ecc24 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/filters/specific/SelectFilter.java +++ b/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/filters/specific/SelectFilter.java @@ -89,8 +89,8 @@ public boolean isNotUsingTemplateAndLabels() { private boolean generateSearchSuffixes = true; @Override - public List getSearchReferences() { - final List out = new ArrayList<>(); + public List> getSearchReferences() { + final List> out = new ArrayList<>(); if (getTemplate() != null) { out.add(getTemplate()); diff --git a/backend/src/main/java/com/bakdata/conquery/models/jobs/UpdateFilterSearchJob.java b/backend/src/main/java/com/bakdata/conquery/models/jobs/UpdateFilterSearchJob.java index 69364a541f..851e41757b 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/jobs/UpdateFilterSearchJob.java +++ b/backend/src/main/java/com/bakdata/conquery/models/jobs/UpdateFilterSearchJob.java @@ -34,13 +34,13 @@ public class UpdateFilterSearchJob extends Job { private final NamespaceStorage storage; @NonNull - private final Map> searchCache; + private final Map, TrieSearch> searchCache; @NonNull private final IndexConfig indexConfig; @NonNull - private final Object2LongMap totals; + private final Object2LongMap> totals; @Override public void execute() throws Exception { @@ -58,7 +58,7 @@ public void execute() throws Exception { .collect(Collectors.toList()); - final Set collectedSearchables = + final Set> collectedSearchables = allSelectFilters.stream() .map(SelectFilter::getSearchReferences) .flatMap(Collection::stream) @@ -71,12 +71,12 @@ public void execute() throws Exception { // Most computations are cheap but data intensive: we fork here to use as many cores as possible. final ExecutorService service = Executors.newCachedThreadPool(); - final Map> synchronizedResult = Collections.synchronizedMap(searchCache); + final Map, TrieSearch> synchronizedResult = Collections.synchronizedMap(searchCache); log.debug("Found {} searchable Objects.", collectedSearchables.size()); - for (Searchable searchable : collectedSearchables) { + for (Searchable searchable : collectedSearchables) { service.submit(() -> { diff --git a/backend/src/main/java/com/bakdata/conquery/models/query/FilterSearch.java b/backend/src/main/java/com/bakdata/conquery/models/query/FilterSearch.java index 4be865eead..83d4836070 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/query/FilterSearch.java +++ b/backend/src/main/java/com/bakdata/conquery/models/query/FilterSearch.java @@ -40,14 +40,14 @@ public class FilterSearch { * In the code below, the keys of this map will usually be called "reference". */ @JsonIgnore - private final Map> searchCache = new HashMap<>(); - private Object2LongMap totals = Object2LongMaps.emptyMap(); + private final Map, TrieSearch> searchCache = new HashMap<>(); + private Object2LongMap> totals = Object2LongMaps.emptyMap(); /** * From a given {@link FrontendValue} extract all relevant keywords. */ public static List extractKeywords(FrontendValue value) { - List keywords = new ArrayList<>(3); + final List keywords = new ArrayList<>(3); keywords.add(value.getLabel()); keywords.add(value.getValue());