From 3240cac4dfec591d31390cac8c29dac89650bcae Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Sun, 17 Apr 2022 16:03:48 +0600 Subject: [PATCH] Full text limit fix (#1424) --- server/core/src/fulltext.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/server/core/src/fulltext.ts b/server/core/src/fulltext.ts index 58bf116366..57a8b4842b 100644 --- a/server/core/src/fulltext.ts +++ b/server/core/src/fulltext.ts @@ -144,23 +144,16 @@ export class FullTextIndex implements WithFind { const { _id, $search, ...mainQuery } = query if ($search === undefined) return toFindResult([]) - let skip = 0 const ids: Set> = new Set>() const baseClass = this.hierarchy.getBaseClass(_class) const classes = this.hierarchy.getDescendants(baseClass) const fullTextLimit = 10000 - while (true) { - const docs = await this.adapter.search(classes, query, fullTextLimit, skip) - for (const doc of docs) { - ids.add(doc.id) - if (doc.attachedTo !== undefined) { - ids.add(doc.attachedTo) - } + const docs = await this.adapter.search(classes, query, fullTextLimit) + for (const doc of docs) { + ids.add(doc.id) + if (doc.attachedTo !== undefined) { + ids.add(doc.attachedTo) } - if (docs.length < fullTextLimit) { - break - } - skip += docs.length } const resultIds = getResultIds(ids, _id) const { limit, ...otherOptions } = options ?? { }