#154 - filter by file extension

This commit is contained in:
Simon Cambier
2023-02-11 15:43:01 +01:00
parent 48c9efcedc
commit 8c78c91cc3
3 changed files with 29 additions and 0 deletions

View File

@@ -175,6 +175,13 @@ export class Omnisearch {
},
})
// Filter query results to only keep files that match query.extensions (if any)
if (query.extensions.length) {
results = results.filter(r =>
query.extensions.some(e => r.id.endsWith(e))
)
}
// If the query does not return any result,
// retry but with a shorter prefix limit
if (!results.length) {