Skip to content

Commit

Permalink
fix(snomed.datastore): Add field replacements for concrete domain...
Browse files Browse the repository at this point in the history
...type refset members in SnomedRefSetMemberSearchRequest
  • Loading branch information
apeteri committed May 17, 2024
1 parent c6470be commit 3497428
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
import com.b2international.snowowl.snomed.datastore.converter.SnomedReferenceSetMemberConverter;
import com.b2international.snowowl.snomed.datastore.index.entry.SnomedDocument;
import com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.common.collect.*;

/**
* @since 4.5
Expand All @@ -53,6 +51,16 @@ public final class SnomedRefSetMemberSearchRequest extends SnomedSearchRequest<S

private static final long serialVersionUID = 1L;

// Requesting the "value" field should load "booleanValue", "decimalValue", "integerValue", "stringValue" and "dataType" instead
private static final Multimap<String, String> REPLACE_VALUE_FIELD = ImmutableMultimap.<String, String>builder()
.putAll(SnomedRf2Headers.FIELD_VALUE,
SnomedRefSetMemberIndexEntry.Fields.BOOLEAN_VALUE,
SnomedRefSetMemberIndexEntry.Fields.DECIMAL_VALUE,
SnomedRefSetMemberIndexEntry.Fields.INTEGER_VALUE,
SnomedRefSetMemberIndexEntry.Fields.STRING_VALUE,
SnomedRefSetMemberIndexEntry.Fields.DATA_TYPE)
.build();

private static final SortedMap<String, SnomedRefsetMemberFieldQueryHandler<?>> SUPPORTED_MEMBER_FIELDS = ImmutableSortedMap.<String, SnomedRefsetMemberFieldQueryHandler<?>>naturalOrder()
// String types, ECL support
.put(SnomedRf2Headers.FIELD_REFERENCED_COMPONENT_ID, new SnomedRefsetMemberFieldQueryHandler<>(String.class, SnomedRefSetMemberIndexEntry.Expressions::referencedComponentIds, true))
Expand Down Expand Up @@ -147,6 +155,11 @@ protected Class<SnomedRefSetMemberIndexEntry> getDocumentType() {
return SnomedRefSetMemberIndexEntry.class;
}

@Override
protected Multimap<String, String> collectFieldsToLoadReplacements() {
return REPLACE_VALUE_FIELD;
}

@Override
protected Expression prepareQuery(BranchContext context) {
final Collection<String> referencedComponentIds = getCollection(OptionKey.REFERENCED_COMPONENT, String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@
*/
final class SnomedRelationshipSearchRequest extends SnomedComponentSearchRequest<SnomedRelationships, SnomedRelationshipIndexEntry> {

// Requesting the "value" field should load "numericValue", "stringValue" and "valueType" instead
private static final Multimap<String, String> REPLACE_VALUE_FIELD = ImmutableMultimap.<String, String>builder()
.putAll(SnomedRelationship.Fields.VALUE, SnomedRelationshipIndexEntry.Fields.NUMERIC_VALUE, SnomedRelationshipIndexEntry.Fields.STRING_VALUE, SnomedRelationshipIndexEntry.Fields.VALUE_TYPE)
.putAll(SnomedRelationship.Fields.VALUE,
SnomedRelationshipIndexEntry.Fields.NUMERIC_VALUE,
SnomedRelationshipIndexEntry.Fields.STRING_VALUE,
SnomedRelationshipIndexEntry.Fields.VALUE_TYPE)
.build();

enum OptionKey {
Expand Down

0 comments on commit 3497428

Please sign in to comment.