core: fix crash when searching

This commit is contained in:
Abdullah Atta
2024-09-16 11:49:49 +05:00
parent 3fe5352b56
commit 7683d8fa5b

View File

@@ -79,6 +79,12 @@ export default class Lookup {
.select(["results.id"])
.groupBy("results.id")
.$if(!!limit, (eb) => eb.limit(limit!))
// filter out ids that have no note against them
.where(
"results.id",
"in",
(notes || this.db.notes.all).filter.select("id")
)
.execute()
.catch((e) => {
logger.error(e, `Error while searching`, { query });