diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/FilterSearch.java b/backend/src/main/java/com/bakdata/conquery/apiv1/FilterSearch.java index f58b0e6c18..0de3625a86 100644 --- a/backend/src/main/java/com/bakdata/conquery/apiv1/FilterSearch.java +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/FilterSearch.java @@ -1,7 +1,14 @@ package com.bakdata.conquery.apiv1; -import com.bakdata.conquery.models.datasets.concepts.filters.specific.AbstractSelectFilter; +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import com.bakdata.conquery.models.datasets.Dataset; +import com.bakdata.conquery.models.datasets.concepts.filters.specific.AbstractSelectFilter; import com.bakdata.conquery.models.jobs.JobManager; import com.bakdata.conquery.models.jobs.SimpleJob; import com.bakdata.conquery.models.worker.DatasetRegistry; @@ -14,9 +21,6 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import java.io.File; -import java.util.*; - @Slf4j public class FilterSearch { @@ -34,7 +38,7 @@ public enum FilterSearchType { @Override public double score(String candidate, String keyword) { /* Sort ascending by length of match */ - if (keyword.startsWith(candidate)) { + if (keyword.startsWith(candidate)) { return 1d / candidate.length(); } return -1d; @@ -152,12 +156,12 @@ public static void createSourceSearch(AbstractSelectFilter filter, CsvParser filter.setSourceSearch(search); FilterSearch.search.put(autocompleteKey, search); - log.info("Processed reference list '{}' in {} ms", file.getAbsolutePath(), System.currentTimeMillis() - time); + log.info("Processed reference list '{}' in {} ms ({} Items)", file.getAbsolutePath(), System.currentTimeMillis() - time, search.getStats().getItems()); } catch (Exception e) { log.error("Failed to process reference list '"+file.getAbsolutePath()+"'", e); } } - + public static void clear() { search.clear(); } diff --git a/backend/src/main/java/com/bakdata/conquery/resources/api/ConceptsProcessor.java b/backend/src/main/java/com/bakdata/conquery/resources/api/ConceptsProcessor.java index a5d49e7a0c..348b6c0597 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/api/ConceptsProcessor.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/api/ConceptsProcessor.java @@ -83,7 +83,11 @@ public List load(Pair, String> filterAndSearch) log.trace("Calculating a new search cache for the term \"{}\" on filter[{}]", searchTerm, filter.getId()); - return autocompleteTextFilter(filter, searchTerm); + final List result = autocompleteTextFilter(filter, searchTerm); + + log.debug("Got {} results for {}", result.size(), filterAndSearch); + + return result; } }); @@ -199,10 +203,11 @@ public AutoCompleteResult autocompleteTextFilter(AbstractSelectFilter filter, private static List autocompleteTextFilter(AbstractSelectFilter filter, String text) { if (Strings.isNullOrEmpty(text)) { // If no text provided, we just list them - return filter.getSourceSearch().listItems() - .stream() - .map(item -> new FEValue(item.getLabel(), item.getValue(), item.getTemplateValues(), item.getOptionValue())) - .collect(Collectors.toList()); + final List items = filter.getSourceSearch().listItems(); + return items + .stream() + .map(item -> new FEValue(item.getLabel(), item.getValue(), item.getTemplateValues(), item.getOptionValue())) + .collect(Collectors.toList()); } List result = new LinkedList<>();