Skip to content

Commit

Permalink
refactor: 全文检索的功能交给meilisearch了
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Oct 24, 2023
1 parent bde1f5b commit 772aaf8
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/app/article/article.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export class ArticleWordpress {
}

@model('article', {timestamps: true})
// eslint-disable-next-line camelcase
@index({content: 'text'}, {default_language: 'ngram'})
export class Article implements IArticleSchema {
@id() public _id!: ObjectId
@prop() public title!: string
Expand Down Expand Up @@ -128,19 +126,6 @@ export class Article implements IArticleSchema {
.skip(skip)
.limit(limit)
}

@statics()
public static async search(this: IArticleModel, keyword: string, skip: number,
limit: number): Promise<IArticleDocument[]> {
return this.find({
$text: {
$search: keyword,
},
})
.sort({_id: -1})
.skip(skip)
.limit(limit)
}
}

export type IArticleDocument = DocumentType<Article>
Expand Down

0 comments on commit 772aaf8

Please sign in to comment.