Skip to content

Commit

Permalink
cleanup ResolveConceptResult
Browse files Browse the repository at this point in the history
  • Loading branch information
awildturtok committed Mar 14, 2023
1 parent 332c34d commit 9ee82d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public FrontendPreviewConfig getEntityPreviewFrontendConfig(Dataset dataset) {
* Search for all search terms at once, with stricter scoring.
* The user will upload a file and expect only well-corresponding resolutions.
*/
public ResolvedConceptsResult resolveFilterValues(Searchable<?> searchable, List<String> searchTerms) {
public ResolvedFilterValues resolveFilterValues(Searchable<?> searchable, List<String> searchTerms) {

// search in the full text engine
final Set<String> openSearchTerms = new HashSet<>(searchTerms);
Expand All @@ -181,7 +181,7 @@ public ResolvedConceptsResult resolveFilterValues(Searchable<?> searchable, List
// Not all Searchables are children of Connectors.
final ConnectorId connectorId = searchable instanceof Filter asFilter ? asFilter.getConnector().getId() : null;

return new ResolvedConceptsResult(null, new ResolvedFilterResult(connectorId, searchable.getId().toString(), out), openSearchTerms);
return new ResolvedFilterValues(new ResolvedFilterResult(connectorId, searchable.getId().toString(), out), openSearchTerms);
}

public AutoCompleteResult autocompleteTextFilter(Searchable<?> searchable, Optional<String> maybeText, OptionalInt pageNumberOpt, OptionalInt itemsPerPageOpt) {
Expand Down Expand Up @@ -309,7 +309,7 @@ public ResolvedConceptsResult resolveConceptElements(TreeConcept concept, List<S
log.error("Error while trying to resolve `{}`", conceptCode, e);
}
}
return new ResolvedConceptsResult(resolvedCodes, null, unknownCodes);
return new ResolvedConceptsResult(resolvedCodes, unknownCodes);
}

/**
Expand All @@ -325,6 +325,10 @@ public record ResolvedFilterResult(ConnectorId tableId, String filterId, Collect
//TODO FK filterId as Id causes issues with IdUtil createParser, should investigate this
}

public record ResolvedConceptsResult(Set<ConceptElementId<?>> resolvedConcepts, ResolvedFilterResult resolvedFilter, Collection<String> unknownCodes) {
public record ResolvedFilterValues(ResolvedFilterResult resolvedFilter, Collection<String> unknownCodes) {

}

public record ResolvedConceptsResult(Set<ConceptElementId<?>> resolvedConcepts, Collection<String> unknownCodes) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.bakdata.conquery.models.auth.permissions.Ability;
import com.bakdata.conquery.models.datasets.concepts.filters.Filter;
import com.bakdata.conquery.models.datasets.concepts.filters.specific.SelectFilter;
import com.bakdata.conquery.resources.api.ConceptsProcessor.ResolvedConceptsResult;
import com.bakdata.conquery.resources.hierarchies.HAuthorized;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
Expand All @@ -44,7 +43,7 @@ public class FilterResource extends HAuthorized {

@POST
@Path("resolve")
public ResolvedConceptsResult resolveFilterValues(FilterValues filterValues) {
public ConceptsProcessor.ResolvedFilterValues resolveFilterValues(FilterValues filterValues) {
subject.isPermitted(filter.getDataset(), Ability.READ);
subject.isPermitted(filter.getConnector().findConcept(), Ability.READ);

Expand Down

0 comments on commit 9ee82d2

Please sign in to comment.