mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Allow search recommendations with wildcard
This commit is contained in:
parent
1338b1fc10
commit
3e79b86179
2 changed files with 18 additions and 6 deletions
|
|
@ -187,14 +187,23 @@ const appendIdsFilter = (body: SearchBody, ids: string[]): void => {
|
|||
}
|
||||
|
||||
const appendRecommendedBy = (body: SearchBody, recommendedBy: string): void => {
|
||||
const query =
|
||||
recommendedBy === '*'
|
||||
? {
|
||||
exists: {
|
||||
field: 'recommendations',
|
||||
},
|
||||
}
|
||||
: {
|
||||
term: {
|
||||
'recommendations.name': recommendedBy,
|
||||
},
|
||||
}
|
||||
|
||||
body.query.bool.must.push({
|
||||
nested: {
|
||||
path: 'recommendations',
|
||||
query: {
|
||||
term: {
|
||||
'recommendations.name': recommendedBy,
|
||||
},
|
||||
},
|
||||
query,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,10 @@ export interface SearchBody {
|
|||
nested: {
|
||||
path: 'recommendations'
|
||||
query: {
|
||||
term: {
|
||||
exists?: {
|
||||
field: string
|
||||
}
|
||||
term?: {
|
||||
'recommendations.name': string
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue