Skip to content

Commit

Permalink
fulltext search test
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Jan 10, 2025
1 parent 9b403ff commit 025fd02
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
5 changes: 0 additions & 5 deletions packages/global/common/error/code/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* team: 503000 */
export enum UserErrEnum {
unAuthUser = 'unAuthUser',
unAuthRole = 'unAuthRole',
binVisitor = 'binVisitor',
balanceNotEnough = 'balanceNotEnough',
unAuthSso = 'unAuthSso'
}
const errList = [
{
statusText: UserErrEnum.unAuthUser,
message: i18nT('common:code_error.user_error.un_auth_user')
},
{
statusText: UserErrEnum.binVisitor,
message: i18nT('common:code_error.user_error.bin_visitor')
Expand Down
12 changes: 7 additions & 5 deletions packages/service/core/dataset/data/dataTextSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ const DatasetDataTextSchema = new Schema({
ref: DatasetDataCollectionName,
required: true
},
fullTextToken: {
type: String,
required: true
}
fullTextToken: String
});

try {
DatasetDataTextSchema.index({ teamId: 1, datasetId: 1, fullTextToken: 'text' });
DatasetDataTextSchema.index(
{ teamId: 1, datasetId: 1, fullTextToken: 'text' },
{
partialFilterExpression: { fullTextToken: { $exists: true } }
}
);
DatasetDataTextSchema.index({ dataId: 1 }, { unique: true });
} catch (error) {
console.log(error);
Expand Down
2 changes: 1 addition & 1 deletion packages/service/core/dataset/search/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ export async function searchDatasetData(props: SearchDatasetDataProps) {
filterCollectionIdList
}),
// FullText tmp
fullTextRecall({
fullTextRecall2({
query,
limit: fullTextLimit,
filterCollectionIdList,
Expand Down
2 changes: 1 addition & 1 deletion packages/service/support/permission/auth/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function getUserChatInfoAndAuthTeamPoints(tmbId: string) {
])
.lean();

if (!tmb) return Promise.reject(UserErrEnum.unAuthUser);
if (!tmb) return Promise.reject(UserErrEnum.binVisitor);

await checkTeamAIPoints(tmb.team._id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
'status'
);
if (!authCert) {
return Promise.reject(UserErrEnum.unAuthUser);
return Promise.reject(UserErrEnum.binVisitor);
}

if (authCert.status === UserStatusEnum.forbidden) {
Expand Down

0 comments on commit 025fd02

Please sign in to comment.