Skip to content

Conversation

@shengquan-ni
Copy link
Contributor

@shengquan-ni shengquan-ni commented Feb 4, 2024

IMPORTANT NOTE: Due to the introduction of dataset in #2391, we need to add a new dataset search query builder to this PR. However, the dataset changes are not merged completely yet, we decide not to support dataset as a searchable resource. After the dataset changes are all merged, we need another PR to add the support.

Background:
In Texera, we have 3 resource types: File, Workflow and Project. Each resource has its access control and schema. We want to be able to search all resources using a single search input box. Our approach is to create a unified schema by union all different schemas to create a big query. This approach also simplifies the handling of offset and limit.

Refactoring:
This PR breaks down the construction of full-text search query into several components for better maintainability:

  1. FulltextSearchQueryUtils contains helper functions to formulate where conditions given query parameters.
  2. UnifiedResourceSchema provides the unified schema, each resource maps its own schema to the unified schema.
  3. SearchQueryBuilder provides a general framework to build a search query of one type of resource. We have FileSearchQueryBuilder, ProjectSearchQueryBuilder and WorkflowSearchQueryBuilder for the existing 3 resource types.
  4. searchAllResources in DashBoardResouce is the endpoint of the full-text search. It unifies all the results and returns them to the front end.

Note:
To improve the quality of search results. I added a substring search(LIKE) condition to the query. If the performance is downgraded by this, we should remove it.

@shengquan-ni shengquan-ni self-assigned this Feb 4, 2024
Copy link
Contributor

@Yicong-Huang Yicong-Huang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactored feature looks pretty good! I think there are some comments to address.

@Yicong-Huang Yicong-Huang added refactor Refactor the code webserver labels Feb 23, 2024
Copy link
Contributor

@Yicong-Huang Yicong-Huang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shengquan-ni shengquan-ni merged commit 0c197fd into master Feb 23, 2024
@shengquan-ni shengquan-ni deleted the shengquan-fix-fulltext-search branch February 23, 2024 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactor the code webserver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants