mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-18 02:31:11 +10:00
feat: search
This commit is contained in:
@ -22,21 +22,34 @@ export class Page {
|
||||
@Column({ length: 500, nullable: true })
|
||||
title: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
icon: string;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
content: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
html: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
textContent: string;
|
||||
|
||||
@Column({
|
||||
type: 'tsvector',
|
||||
generatedType: 'STORED',
|
||||
asExpression:
|
||||
"setweight(to_tsvector('english', coalesce(pages.title, '')), 'A') || setweight(to_tsvector('english', coalesce(pages.\"textContent\", '')), 'B')",
|
||||
select: false,
|
||||
nullable: true,
|
||||
})
|
||||
tsv: string;
|
||||
|
||||
@Column({ type: 'bytea', nullable: true })
|
||||
ydoc: any;
|
||||
|
||||
@Column({ nullable: true })
|
||||
slug: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
icon: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
coverPhoto: string;
|
||||
|
||||
|
||||
@ -26,6 +26,11 @@ import { PageHistoryRepository } from './repositories/page-history.repository';
|
||||
PageRepository,
|
||||
PageHistoryRepository,
|
||||
],
|
||||
exports: [PageService, PageOrderingService, PageHistoryService],
|
||||
exports: [
|
||||
PageService,
|
||||
PageOrderingService,
|
||||
PageHistoryService,
|
||||
PageRepository,
|
||||
],
|
||||
})
|
||||
export class PageModule {}
|
||||
|
||||
@ -108,11 +108,13 @@ export class PageService {
|
||||
async updateState(
|
||||
pageId: string,
|
||||
content: any,
|
||||
textContent: string,
|
||||
ydoc: any,
|
||||
userId?: string, // TODO: fix this
|
||||
): Promise<void> {
|
||||
await this.pageRepository.update(pageId, {
|
||||
content: content,
|
||||
textContent: textContent,
|
||||
ydoc: ydoc,
|
||||
...(userId && { lastUpdatedById: userId }),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user