Correct implementation of tagsAllOf
This commit is contained in:
parent
34dcbaa200
commit
8f26b09f11
|
@ -4,7 +4,6 @@ import { flatMap } from 'lodash'
|
|||
import { Avatar } from '@shared/models'
|
||||
import { buildSort, elasticSearch } from '../helpers/elastic-search'
|
||||
import { VideosSearchQuery } from '../types/video-search.model'
|
||||
import { inspect } from 'util'
|
||||
|
||||
function initVideosIndex () {
|
||||
return elasticSearch.indices.create({
|
||||
|
@ -171,23 +170,22 @@ async function queryVideos (search: VideosSearchQuery) {
|
|||
})
|
||||
}
|
||||
|
||||
// FIXME: rework
|
||||
if (search.tagsOneOf) {
|
||||
filter.push({
|
||||
terms: {
|
||||
tags: search.tagsOneOf,
|
||||
minimum_should_match: 1
|
||||
tags: search.tagsOneOf
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (search.tagsAllOf) {
|
||||
filter.push({
|
||||
terms: {
|
||||
tags: search.tagsOneOf,
|
||||
minimum_should_match: 1
|
||||
}
|
||||
})
|
||||
for (const t of search.tagsAllOf) {
|
||||
filter.push({
|
||||
term: {
|
||||
tags: t
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (search.durationMin) {
|
||||
|
|
Loading…
Reference in New Issue