mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 11:50:56 +00:00
Full text limit fix (#1424)
This commit is contained in:
parent
e5187e7d4a
commit
3240cac4df
@ -144,23 +144,16 @@ export class FullTextIndex implements WithFind {
|
|||||||
const { _id, $search, ...mainQuery } = query
|
const { _id, $search, ...mainQuery } = query
|
||||||
if ($search === undefined) return toFindResult([])
|
if ($search === undefined) return toFindResult([])
|
||||||
|
|
||||||
let skip = 0
|
|
||||||
const ids: Set<Ref<Doc>> = new Set<Ref<Doc>>()
|
const ids: Set<Ref<Doc>> = new Set<Ref<Doc>>()
|
||||||
const baseClass = this.hierarchy.getBaseClass(_class)
|
const baseClass = this.hierarchy.getBaseClass(_class)
|
||||||
const classes = this.hierarchy.getDescendants(baseClass)
|
const classes = this.hierarchy.getDescendants(baseClass)
|
||||||
const fullTextLimit = 10000
|
const fullTextLimit = 10000
|
||||||
while (true) {
|
const docs = await this.adapter.search(classes, query, fullTextLimit)
|
||||||
const docs = await this.adapter.search(classes, query, fullTextLimit, skip)
|
for (const doc of docs) {
|
||||||
for (const doc of docs) {
|
ids.add(doc.id)
|
||||||
ids.add(doc.id)
|
if (doc.attachedTo !== undefined) {
|
||||||
if (doc.attachedTo !== undefined) {
|
ids.add(doc.attachedTo)
|
||||||
ids.add(doc.attachedTo)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (docs.length < fullTextLimit) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
skip += docs.length
|
|
||||||
}
|
}
|
||||||
const resultIds = getResultIds(ids, _id)
|
const resultIds = getResultIds(ids, _id)
|
||||||
const { limit, ...otherOptions } = options ?? { }
|
const { limit, ...otherOptions } = options ?? { }
|
||||||
|
Loading…
Reference in New Issue
Block a user