Yicong-Huang commented on code in PR #7464:
URL: https://github.com/apache/texera/pull/7464#discussion_r3900635500
##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/DashboardResource.scala:
##########
@@ -95,15 +92,12 @@ object DashboardResource {
val query = params.resourceType match {
case SearchQueryBuilder.WORKFLOW_RESOURCE_TYPE =>
WorkflowSearchQueryBuilder.constructQuery(uid, params, includePublic)
- case SearchQueryBuilder.PROJECT_RESOURCE_TYPE =>
- ProjectSearchQueryBuilder.constructQuery(uid, params, includePublic)
case SearchQueryBuilder.DATASET_RESOURCE_TYPE =>
DatasetSearchQueryBuilder.constructQuery(uid, params, includePublic)
case SearchQueryBuilder.ALL_RESOURCE_TYPE =>
val q1 = WorkflowSearchQueryBuilder.constructQuery(uid, params,
includePublic)
- val q3 = ProjectSearchQueryBuilder.constructQuery(uid, params,
includePublic)
val q4 = DatasetSearchQueryBuilder.constructQuery(uid, params,
includePublic)
- q1.unionAll(q3).unionAll(q4)
+ q1.unionAll(q4)
Review Comment:
Deleting the project sub-query leaves `q1` next to `q4`, so the numbering
now points at two queries that no longer exist. Naming them after what they
select removes the question.
```suggestion
val workflowQuery = WorkflowSearchQueryBuilder.constructQuery(uid,
params, includePublic)
val datasetQuery = DatasetSearchQueryBuilder.constructQuery(uid,
params, includePublic)
workflowQuery.unionAll(datasetQuery)
```
##########
amber/src/test/scala/org/apache/texera/web/resource/dashboard/file/WorkflowResourceSpec.scala:
##########
@@ -681,99 +634,104 @@ class WorkflowResourceSpec
)
}
- "/search API" should "be able to search for resources in different tables"
in {
+ "/search API" should "be able to search for resources by keyword" in {
- // create different types of resources, project, workflow, and file
- projectResource.createProject(sessionUser1, "test project1")
workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
// search
val DashboardClickableFileEntryList =
dashboardResource.searchAllResourcesCall(
sessionUser1,
SearchQueryParams(getKeywordsArray("test"))
)
- assert(DashboardClickableFileEntryList.results.length == 2)
+ assert(DashboardClickableFileEntryList.results.length == 1)
}
it should "return all resources when no keyword provided" in {
- projectResource.createProject(sessionUser1, "test project1")
workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
val DashboardClickableFileEntryList =
dashboardResource.searchAllResourcesCall(
sessionUser1,
SearchQueryParams(getKeywordsArray(""))
)
- assert(DashboardClickableFileEntryList.results.length == 2)
+ assert(DashboardClickableFileEntryList.results.length == 1)
}
it should "return multiple matching resources from a single resource type"
in {
workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
- projectResource.createProject(sessionUser1, "common project1")
- projectResource.createProject(sessionUser1, "common project2")
+ workflowResource.persistWorkflow(testWorkflow2, sessionUser1)
val DashboardClickableFileEntryList =
dashboardResource.searchAllResourcesCall(
sessionUser1,
- SearchQueryParams(getKeywordsArray("common"))
+ SearchQueryParams(getKeywordsArray("test"))
)
assert(DashboardClickableFileEntryList.results.length == 2)
}
it should "handle multiple keywords correctly" in {
- projectResource.createProject(sessionUser1, "test project1")
workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
+ workflowResource.persistWorkflow(testWorkflow2, sessionUser1)
val DashboardClickableFileEntryList =
dashboardResource.searchAllResourcesCall(
sessionUser1,
- SearchQueryParams(getKeywordsArray("test", "project1"))
+ SearchQueryParams(getKeywordsArray("test", "workflow1"))
)
assert(
DashboardClickableFileEntryList.results.length == 1
- ) // should only return the project
+ ) // should only return test_workflow1
}
it should "filter results by different resourceType" in {
- // create different types of resources
- // 3 projects, 2 file, and 1 workflow,
- projectResource.createProject(sessionUser1, "test project1")
- projectResource.createProject(sessionUser1, "test project2")
- projectResource.createProject(sessionUser1, "test project3")
+ // create 3 workflows
workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
+ workflowResource.persistWorkflow(testWorkflow2, sessionUser1)
+ workflowResource.persistWorkflow(testWorkflow3, sessionUser1)
// search resources with all resourceType
var DashboardClickableFileEntryList =
dashboardResource.searchAllResourcesCall(
sessionUser1,
SearchQueryParams(getKeywordsArray("test"))
)
- assert(DashboardClickableFileEntryList.results.length == 4)
+ assert(DashboardClickableFileEntryList.results.length == 3)
// filter resources by workflow
DashboardClickableFileEntryList = dashboardResource.searchAllResourcesCall(
sessionUser1,
SearchQueryParams(resourceType = "workflow", keywords =
getKeywordsArray("test"))
)
- assert(DashboardClickableFileEntryList.results.length == 1)
+ assert(DashboardClickableFileEntryList.results.length == 3)
- // filter resources by project
+ // filter resources by dataset
DashboardClickableFileEntryList = dashboardResource.searchAllResourcesCall(
sessionUser1,
- SearchQueryParams(resourceType = "project", keywords =
getKeywordsArray("test"))
+ SearchQueryParams(resourceType = "dataset", keywords =
getKeywordsArray("test"))
)
- assert(DashboardClickableFileEntryList.results.length == 3)
+ assert(DashboardClickableFileEntryList.results.isEmpty)
+
+ // The counts above cannot distinguish a working filter from an ignored
one, because every
+ // seeded row is a workflow and the only other searchable types are
LakeFS-backed (a seeded
Review Comment:
After this PR `searchAllResources` dispatches exactly `workflow` and
`dataset` (`DashboardResource.scala:93-100`), so one other searchable type
remains, not several.
```suggestion
// seeded row is a workflow and the only other searchable type is
LakeFS-backed (a seeded
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]