Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Optimise indexation #294

Merged
merged 5 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions apps/admin/src/queries/records/recordsListQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,7 @@ export const getRecordsListQuery = (library: string) => gqlUnchecked`
id,
label,
color,
preview {
small
medium
pdf
big
},
preview,
library{
id,
label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as amqp from 'amqplib';
import {IAttributeDomain} from 'domain/attribute/attributeDomain';
import {ILibraryDomain} from 'domain/library/libraryDomain';
import {IRecordDomain} from 'domain/record/recordDomain';
import {IRecordRepo} from 'infra/record/recordRepo';
import {IConfig} from '_types/config';
import {IQueryInfos} from '_types/queryInfos';
import indexationManager from './indexationManagerDomain';
Expand Down Expand Up @@ -83,10 +82,6 @@ describe('Indexation Manager', () => {
});

test('index database', async () => {
const mockRecordRepo: Mockify<IRecordRepo> = {
updateRecord: jest.fn()
};

const mockRecordDomain: Mockify<IRecordDomain> = {
find: global.__mockPromise({
list: [
Expand All @@ -101,7 +96,8 @@ describe('Indexation Manager', () => {
};

const mockAttributeDomain: Mockify<IAttributeDomain> = {
getLibraryFullTextAttributes: global.__mockPromise([{id: 'id'}])
getLibraryFullTextAttributes: global.__mockPromise([{id: 'id'}]),
getLibraryAttributes: global.__mockPromise([{id: 'id'}])
};

const mockLibraryDomain: Mockify<ILibraryDomain> = {
Expand All @@ -120,7 +116,6 @@ describe('Indexation Manager', () => {
const indexation = indexationManager({
config: conf as IConfig,
'core.domain.record': mockRecordDomain as IRecordDomain,
'core.infra.record': mockRecordRepo as IRecordRepo,
'core.domain.attribute': mockAttributeDomain as IAttributeDomain,
'core.domain.library': mockLibraryDomain as ILibraryDomain,
'core.infra.indexation.indexationService': mockIndexationService as IIndexationService
Expand Down
263 changes: 106 additions & 157 deletions apps/core/src/domain/indexationManager/indexationManagerDomain.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/core/src/infra/indexation/indexationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function ({
await recordRepo.updateRecord({
libraryId,
recordData: {id: recordId, [CORE_INDEX_FIELD]: data},
mergeObjects: false
mergeObjects: true
});
},
getSearchQuery
Expand Down
2 changes: 1 addition & 1 deletion apps/data-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@leav/ui": "workspace:libs/ui",
"@leav/utils": "workspace:libs/utils",
"@reduxjs/toolkit": "1.9.2",
"antd": "5.6.4",
"antd": "5.7.0",
"apollo-cache-inmemory": "1.6.6",
"apollo-upload-client": "14.1.3",
"dayjs": "1.11.7",
Expand Down
2 changes: 1 addition & 1 deletion apps/login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@ant-design/icons": "5.1.4",
"@leav/ui": "workspace:libs/ui",
"antd": "5.6.4",
"antd": "5.7.0",
"i18next": "22.5.0",
"i18next-browser-languagedetector": "7.0.2",
"i18next-http-backend": "2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/portal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@ant-design/icons": "5.1.4",
"@apollo/client": "3.7.10",
"@leav/ui": "workspace:libs/ui",
"antd": "5.6.4",
"antd": "5.7.0",
"cross-fetch": "3.1.5",
"graphql-ws": "5.12.0",
"i18next": "22.5.0",
Expand Down
Loading
Loading