use votes in es queries

This commit is contained in:
keyan 2022-10-28 11:00:53 -05:00
parent cb7f68e0e5
commit ba5c40d165

View File

@ -1,3 +1,4 @@
import { ITEM_FILTER_THRESHOLD } from '../../lib/constants'
import { decodeCursor, LIMIT, nextCursorEncoded } from '../../lib/cursor' import { decodeCursor, LIMIT, nextCursorEncoded } from '../../lib/cursor'
import { getItem } from './item' import { getItem } from './item'
@ -73,11 +74,11 @@ export default {
], ],
must_not: [{ exists: { field: 'parentId' } }, ...mustNot], must_not: [{ exists: { field: 'parentId' } }, ...mustNot],
filter: { filter: {
range: { sats: { gte: 10 } } range: { wvotes: { gte: 0.2 } }
} }
} }
}, },
sort: ['_score', { sats: 'desc' }] sort: ['_score', { wvotes: 'desc' }, { sats: 'desc' }]
} }
}) })
@ -243,7 +244,8 @@ export default {
createdAt: { createdAt: {
lte: decodedCursor.time, lte: decodedCursor.time,
gte: whenGte gte: whenGte
} },
wvotes: { gt: -1 * ITEM_FILTER_THRESHOLD }
} }
} }
} }