Skip to content

Commit df3bac0

Browse files
authored
Merge pull request #194 from sat-utils/develop
Develop
2 parents 2d0fd26 + 9785a36 commit df3bac0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

packages/api-lib/libs/es.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ function buildDatetimeQuery(parameters) {
263263

264264
function buildQuery(parameters) {
265265
const eq = 'eq'
266+
const inop = 'in'
266267
const { query, intersects } = parameters
267268
let must = []
268269
if (query) {
@@ -278,6 +279,13 @@ function buildQuery(parameters) {
278279
}
279280
}
280281
accumulator.push(termQuery)
282+
} else if (operators.includes(inop)) {
283+
const termsQuery = {
284+
terms: {
285+
[`properties.${property}`]: operatorsObject.in
286+
}
287+
}
288+
accumulator.push(termsQuery)
281289
}
282290
const rangeQuery =
283291
buildRangeQuery(property, operators, operatorsObject)

packages/api-lib/tests/integration/test_api.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,14 @@ test('stac/search fields filter', async (t) => {
222222
}, backend, endpoint)
223223
t.truthy(response.features.length, 'Does not exclude required fields')
224224
})
225+
226+
test('stac/search in query', async (t) => {
227+
const response = await search('/stac/search', {
228+
query: {
229+
'landsat:path': {
230+
in: ['10']
231+
}
232+
}
233+
}, backend, endpoint)
234+
t.is(response.features.length, 3)
235+
})

0 commit comments

Comments
 (0)