Skip to content

Commit

Permalink
hacked fixed for taxon_depth in predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
djtfmartin committed Sep 27, 2024
1 parent 476cc11 commit 18b97dd
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ private String getChecklistExactMatchOrVerbatimField(EqualsPredicate<S> predicat
return esFieldMapper.getChecklistField(predicate.getChecklistKey(), predicate.getKey());
}

private String getChecklistExactMatchOrVerbatimField(InPredicate<S> predicate) {
return esFieldMapper.getChecklistField(predicate.getChecklistKey(), predicate.getKey());
}

/**
* Translates a valid {@link org.gbif.api.model.occurrence.Download} object and translates it into
* a json query that can be used as the <em>body</em> for _search request of ES index.
Expand Down Expand Up @@ -436,14 +440,26 @@ public void visit(InPredicate<S> predicate, BoolQueryBuilder queryBuilder) {
});

} else {
queryBuilder
.filter()
.add(
QueryBuilders.termsQuery(
getExactMatchOrVerbatimField(predicate),
predicate.getValues().stream()
.map(v -> parseParamValue(v, parameter))
.collect(Collectors.toList())));

if (predicate.getChecklistKey() != null){
queryBuilder
.filter()
.add(
QueryBuilders.termsQuery(
getChecklistExactMatchOrVerbatimField(predicate),
predicate.getValues().stream()
.map(v -> parseParamValue(v, parameter))
.collect(Collectors.toList())));
} else {
queryBuilder
.filter()
.add(
QueryBuilders.termsQuery(
getExactMatchOrVerbatimField(predicate),
predicate.getValues().stream()
.map(v -> parseParamValue(v, parameter))
.collect(Collectors.toList())));
}
}
}

Expand Down

0 comments on commit 18b97dd

Please sign in to comment.