Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
3bfe802c
authored
Feb 24, 2025
by
heheer
Committed by
GitHub
Feb 24, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix collection folder tags filter (#3853)
* fix collection folder tags filter * add comment * fix
parent
2bf17dbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
7 deletions
+73
-7
packages/service/core/dataset/search/controller.ts
+73
-7
No files found.
packages/service/core/dataset/search/controller.ts
View file @
3bfe802c
...
@@ -200,6 +200,62 @@ export async function searchDatasetData(
...
@@ -200,6 +200,62 @@ export async function searchDatasetData(
forbidCollectionIdList
:
collections
.
map
((
item
)
=>
String
(
item
.
_id
))
forbidCollectionIdList
:
collections
.
map
((
item
)
=>
String
(
item
.
_id
))
};
};
};
};
async
function
getAllCollectionIds
({
teamId
,
datasetIds
,
parentCollectionIds
}:
{
teamId
:
string
;
datasetIds
:
string
[];
parentCollectionIds
:
string
[];
}):
Promise
<
string
[]
>
{
if
(
!
parentCollectionIds
.
length
)
{
return
[];
}
const
collections
=
await
MongoDatasetCollection
.
find
(
{
teamId
,
datasetId
:
{
$in
:
datasetIds
},
_id
:
{
$in
:
parentCollectionIds
}
},
'_id type'
,
{
...
readFromSecondary
}
).
lean
();
const
resultIds
=
new
Set
(
collections
.
map
((
item
)
=>
String
(
item
.
_id
)));
const
folderIds
=
collections
.
filter
((
item
)
=>
item
.
type
===
'folder'
)
.
map
((
item
)
=>
String
(
item
.
_id
));
// Get all child collection ids
if
(
folderIds
.
length
)
{
const
childCollections
=
await
MongoDatasetCollection
.
find
(
{
teamId
,
datasetId
:
{
$in
:
datasetIds
},
parentId
:
{
$in
:
folderIds
}
},
'_id'
,
{
...
readFromSecondary
}
).
lean
();
const
childIds
=
await
getAllCollectionIds
({
teamId
,
datasetIds
,
parentCollectionIds
:
childCollections
.
map
((
item
)
=>
String
(
item
.
_id
))
});
childIds
.
forEach
((
id
)
=>
resultIds
.
add
(
id
));
}
return
Array
.
from
(
resultIds
);
}
/*
/*
Collection metadata filter
Collection metadata filter
标签过滤:
标签过滤:
...
@@ -326,13 +382,23 @@ export async function searchDatasetData(
...
@@ -326,13 +382,23 @@ export async function searchDatasetData(
}
}
// Concat tag and time
// Concat tag and time
if
(
tagCollectionIdList
&&
createTimeCollectionIdList
)
{
const
finalIds
=
(()
=>
{
return
tagCollectionIdList
.
filter
((
id
)
=>
createTimeCollectionIdList
!
.
includes
(
id
));
if
(
tagCollectionIdList
&&
createTimeCollectionIdList
)
{
}
else
if
(
tagCollectionIdList
)
{
return
tagCollectionIdList
.
filter
((
id
)
=>
return
tagCollectionIdList
;
(
createTimeCollectionIdList
as
string
[]).
includes
(
id
)
}
else
if
(
createTimeCollectionIdList
)
{
);
return
createTimeCollectionIdList
;
}
}
return
tagCollectionIdList
||
createTimeCollectionIdList
;
})();
return
finalIds
?
await
getAllCollectionIds
({
teamId
,
datasetIds
,
parentCollectionIds
:
finalIds
})
:
undefined
;
}
catch
(
error
)
{}
}
catch
(
error
)
{}
};
};
const
embeddingRecall
=
async
({
const
embeddingRecall
=
async
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment