mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Refactor exclude labels query
This commit is contained in:
parent
9584267c48
commit
153ca6995b
2 changed files with 7 additions and 8 deletions
|
|
@ -114,16 +114,15 @@ const appendExcludeLabelFilter = (
|
|||
body: SearchBody,
|
||||
filters: LabelFilter[]
|
||||
): void => {
|
||||
const labels = filters.map((filter) => filter.labels).flat()
|
||||
body.query.bool.must_not.push({
|
||||
nested: {
|
||||
path: 'labels',
|
||||
query: filters.map((filter) => {
|
||||
return {
|
||||
terms: {
|
||||
'labels.name': filter.labels,
|
||||
},
|
||||
}
|
||||
}),
|
||||
query: {
|
||||
terms: {
|
||||
'labels.name': labels,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export interface SearchBody {
|
|||
terms: {
|
||||
'labels.name': string[]
|
||||
}
|
||||
}[]
|
||||
}
|
||||
}
|
||||
}
|
||||
)[]
|
||||
|
|
|
|||
Loading…
Reference in a new issue