Skip to content

Commit

Permalink
Merge pull request #104 from dbmi-pitt/tjmadonna/hierarchy-subvalue-f…
Browse files Browse the repository at this point in the history
…ilter

Tjmadonna/hierarchy subvalue filter
  • Loading branch information
maxsibilla authored Oct 8, 2024
2 parents 76c4ae4 + f1681d0 commit 95de585
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions components/core/HierarchyFacet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ export default function HierarchyFacet({
}

if (!isHierarchical) {
const firstBucket = option.subagg.buckets[0]
let subValues = option.subagg.buckets
if (facet.filterSubValues) {
subValues = facet.filterSubValues(option.key, subValues)
}

const firstBucket = subValues[0]
return (
<TermOptionFacet
key={option.key}
Expand All @@ -72,6 +77,11 @@ export default function HierarchyFacet({
)
}

let subValues = option.subagg.buckets
if (facet.filterSubValues) {
subValues = facet.filterSubValues(option.key, subValues)
}

return (
<HierarchyOptionFacet
key={option.key}
Expand All @@ -81,7 +91,7 @@ export default function HierarchyFacet({
transformFunction={transformFunction}
value={option.key}
count={option.doc_count}
subValues={option.subagg.buckets}
subValues={subValues}
/>
)
})}
Expand Down

0 comments on commit 95de585

Please sign in to comment.