mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 08:48:01 +00:00
TSK-1131/TSK-1101 (#2945)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
0ffa5f7f5f
commit
b8b8e8bd44
models/recruit/src
packages/core/src
pods
server/core/src
@ -606,10 +606,9 @@ export function createModel (builder: Builder): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const applicantViewOptions: ViewOptionsModel = {
|
const applicantViewOptions: ViewOptionsModel = {
|
||||||
groupBy: ['state', 'doneState', 'assignee', 'space'],
|
groupBy: ['state', 'assignee', 'space'],
|
||||||
orderBy: [
|
orderBy: [
|
||||||
['state', SortingOrder.Ascending],
|
['state', SortingOrder.Ascending],
|
||||||
['doneState', SortingOrder.Ascending],
|
|
||||||
['modifiedOn', SortingOrder.Descending],
|
['modifiedOn', SortingOrder.Descending],
|
||||||
['dueDate', SortingOrder.Descending],
|
['dueDate', SortingOrder.Descending],
|
||||||
['rank', SortingOrder.Ascending]
|
['rank', SortingOrder.Ascending]
|
||||||
|
@ -24,7 +24,7 @@ import { SortingOrder } from './storage'
|
|||||||
import { Tx, TxCreateDoc, TxProcessor, TxUpdateDoc } from './tx'
|
import { Tx, TxCreateDoc, TxProcessor, TxUpdateDoc } from './tx'
|
||||||
import { toFindResult } from './utils'
|
import { toFindResult } from './utils'
|
||||||
|
|
||||||
const transactionThreshold = 3000
|
const transactionThreshold = 500
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -193,7 +193,7 @@ export async function createClient (
|
|||||||
// Find all new transactions and apply
|
// Find all new transactions and apply
|
||||||
await loadModel(conn, loadedTxIds, allowedPlugins, configs, hierarchy, model)
|
await loadModel(conn, loadedTxIds, allowedPlugins, configs, hierarchy, model)
|
||||||
|
|
||||||
// We need to look for last 1000 transactions and if it is more since lastTx one we receive, we need to perform full refresh.
|
// We need to look for last {transactionThreshold} transactions and if it is more since lastTx one we receive, we need to perform full refresh.
|
||||||
const atxes = await conn.findAll(
|
const atxes = await conn.findAll(
|
||||||
core.class.Tx,
|
core.class.Tx,
|
||||||
{ modifiedOn: { $gt: lastTx } },
|
{ modifiedOn: { $gt: lastTx } },
|
||||||
|
@ -6,4 +6,4 @@ WORKDIR /usr/src/app
|
|||||||
COPY bundle.js ./
|
COPY bundle.js ./
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD [ "node", "--enable-source-maps", "bundle.js" ]
|
CMD [ "node", "bundle.js" ]
|
||||||
|
@ -5,4 +5,4 @@ WORKDIR /usr/src/app
|
|||||||
COPY bundle.js ./
|
COPY bundle.js ./
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD [ "node", "--enable-source-maps", "bundle.js" ]
|
CMD [ "node", "bundle.js" ]
|
||||||
|
@ -23,6 +23,7 @@ import core, {
|
|||||||
FindOptions,
|
FindOptions,
|
||||||
FindResult,
|
FindResult,
|
||||||
Hierarchy,
|
Hierarchy,
|
||||||
|
IndexKind,
|
||||||
MeasureContext,
|
MeasureContext,
|
||||||
ObjQueryType,
|
ObjQueryType,
|
||||||
Ref,
|
Ref,
|
||||||
@ -128,8 +129,19 @@ export class FullTextIndex implements WithFind {
|
|||||||
let classes = this.hierarchy.getDescendants(baseClass)
|
let classes = this.hierarchy.getDescendants(baseClass)
|
||||||
|
|
||||||
const attrs = this.hierarchy.getAllAttributes(_class)
|
const attrs = this.hierarchy.getAllAttributes(_class)
|
||||||
|
|
||||||
|
// We need to filter all non indexed fields from query to make it work properly
|
||||||
|
const findQuery: DocumentQuery<Doc> = {
|
||||||
|
$search: query.$search
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
for (const attr of attrs.values()) {
|
for (const [k, attr] of attrs) {
|
||||||
|
if (attr.index === IndexKind.FullText) {
|
||||||
|
const vv = (query as any)[k]
|
||||||
|
if (vv != null) {
|
||||||
|
findQuery[k] = vv
|
||||||
|
}
|
||||||
|
}
|
||||||
if (attr.type._class === core.class.Collection) {
|
if (attr.type._class === core.class.Collection) {
|
||||||
// we need attached documents to be in clases
|
// we need attached documents to be in clases
|
||||||
const dsc = this.hierarchy.getDescendants(attr.attributeOf)
|
const dsc = this.hierarchy.getDescendants(attr.attributeOf)
|
||||||
@ -143,7 +155,8 @@ export class FullTextIndex implements WithFind {
|
|||||||
classes = classes.filter((it, idx, arr) => arr.indexOf(it) === idx)
|
classes = classes.filter((it, idx, arr) => arr.indexOf(it) === idx)
|
||||||
|
|
||||||
const fullTextLimit = options?.limit ?? 200
|
const fullTextLimit = options?.limit ?? 200
|
||||||
let { docs, pass } = await this.indexer.search(classes, query, fullTextLimit)
|
|
||||||
|
let { docs, pass } = await this.indexer.search(classes, findQuery, fullTextLimit)
|
||||||
|
|
||||||
if (docs.length === 0 && pass) {
|
if (docs.length === 0 && pass) {
|
||||||
docs = [...docs, ...(await this.adapter.search(classes, query, fullTextLimit))]
|
docs = [...docs, ...(await this.adapter.search(classes, query, fullTextLimit))]
|
||||||
|
@ -212,7 +212,7 @@ export class IndexedFieldStage implements FullTextPipelineStage {
|
|||||||
if (pipeline.hierarchy.isMixin(d) && pipeline.hierarchy.hasMixin(doc, d)) {
|
if (pipeline.hierarchy.isMixin(d) && pipeline.hierarchy.hasMixin(doc, d)) {
|
||||||
const mContext = getFullTextContext(pipeline.hierarchy, d)
|
const mContext = getFullTextContext(pipeline.hierarchy, d)
|
||||||
if (mContext.propogate !== undefined) {
|
if (mContext.propogate !== undefined) {
|
||||||
propogate = [...mContext.propogate]
|
propogate = [...propogate, ...mContext.propogate]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user