Skip to content

Commit

Permalink
fix: apply logical operators to number search facet
Browse files Browse the repository at this point in the history
  • Loading branch information
robinpyon committed Dec 16, 2020
1 parent 6521c7f commit f6299f7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/modules/assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,15 @@ const constructFilter = (searchFacets: SearchFacetProps[], searchQuery?: string)
}

if (facet.type === 'select') {
const {options, value} = facet
const {operators, options, value} = facet

const currentListItem = options?.list.find(l => l.name === value)
const currentListValue = options?.list.find(l => l.name === value)?.value

return currentListItem?.value
if (operators.logical === 'not') {
return `!(${currentListValue})`
}

return currentListValue
}

throw Error(`type must be either 'number' or 'select'`)
Expand Down

0 comments on commit f6299f7

Please sign in to comment.