Skip to content

Commit

Permalink
appeases the java type system demons
Browse files Browse the repository at this point in the history
  • Loading branch information
awildturtok committed Mar 14, 2023
1 parent 340824c commit 332c34d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public List<TrieSearch<FrontendValue>> getSearches(IndexConfig config, Namespace
}

@Override
public List<Searchable> getSearchReferences() {
public List<Searchable<?>> getSearchReferences() {
return List.of(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface Searchable<ID extends Id<? extends Identifiable<? extends ID>>>
* @implSpec The order of objects returned is used to also sort search results from different sources.
*/
@JsonIgnore
default List<Searchable> getSearchReferences() {
default List<Searchable<?>> getSearchReferences() {
//Hopefully the only candidate will be Column
return List.of(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public boolean isNotUsingTemplateAndLabels() {
private boolean generateSearchSuffixes = true;

@Override
public List<Searchable> getSearchReferences() {
final List<Searchable> out = new ArrayList<>();
public List<Searchable<?>> getSearchReferences() {
final List<Searchable<?>> out = new ArrayList<>();

if (getTemplate() != null) {
out.add(getTemplate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public class UpdateFilterSearchJob extends Job {
private final NamespaceStorage storage;

@NonNull
private final Map<Searchable, TrieSearch<FrontendValue>> searchCache;
private final Map<Searchable<?>, TrieSearch<FrontendValue>> searchCache;

@NonNull
private final IndexConfig indexConfig;

@NonNull
private final Object2LongMap<Searchable> totals;
private final Object2LongMap<Searchable<?>> totals;

@Override
public void execute() throws Exception {
Expand All @@ -58,7 +58,7 @@ public void execute() throws Exception {
.collect(Collectors.toList());


final Set<Searchable> collectedSearchables =
final Set<Searchable<?>> collectedSearchables =
allSelectFilters.stream()
.map(SelectFilter::getSearchReferences)
.flatMap(Collection::stream)
Expand All @@ -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<Searchable, TrieSearch<FrontendValue>> synchronizedResult = Collections.synchronizedMap(searchCache);
final Map<Searchable<?>, TrieSearch<FrontendValue>> synchronizedResult = Collections.synchronizedMap(searchCache);

log.debug("Found {} searchable Objects.", collectedSearchables.size());


for (Searchable searchable : collectedSearchables) {
for (Searchable<?> searchable : collectedSearchables) {

service.submit(() -> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Searchable, TrieSearch<FrontendValue>> searchCache = new HashMap<>();
private Object2LongMap<Searchable> totals = Object2LongMaps.emptyMap();
private final Map<Searchable<?>, TrieSearch<FrontendValue>> searchCache = new HashMap<>();
private Object2LongMap<Searchable<?>> totals = Object2LongMaps.emptyMap();

/**
* From a given {@link FrontendValue} extract all relevant keywords.
*/
public static List<String> extractKeywords(FrontendValue value) {
List<String> keywords = new ArrayList<>(3);
final List<String> keywords = new ArrayList<>(3);

keywords.add(value.getLabel());
keywords.add(value.getValue());
Expand Down

0 comments on commit 332c34d

Please sign in to comment.