Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search in workspace folder #204

Merged
merged 10 commits into from
Mar 18, 2024
Merged

Search in workspace folder #204

merged 10 commits into from
Mar 18, 2024

Conversation

zekehuntergreen
Copy link
Contributor

@zekehuntergreen zekehuntergreen commented Mar 14, 2024

What does this change?

  • Introduces a new "workspace folder" Chip (documented here Search in Giant) which allows a user to search inside a specific folder in a workspace.
    • at the moment, a "workspace folder" chip can be removed but not created or edited
  • Adds a "search in folder" item to the context menu when a user right clicks on a folder in the workspace view. This links to the search view with a "workspace folder" chip pre-populated.
  • Changes to the /search endpoint to handle this new chip type. Most of the logic to filter by the blobs in a folder was introduced in https://github.com/guardian/pfi/pull/811 and is repurposed here.

How to test

  • tested in CODE

How can we measure success?

Users will be able to search inside a folder inside a workspace.

Potential future changes

  • We could add the ability to create and edit workspace folder chips directly from the search page with a typeahead of workspace and folder names.

Example

giant.search.in.folder.mov

@zekehuntergreen zekehuntergreen requested a review from a team as a code owner March 14, 2024 14:42
workspaceId: workspace.id,
folderId: entry.id,
},
"*"
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking this might have been a mistake but actually a good shout to start with * so that there are documents visible straight away before the user adds a search

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep that's what I was thinking. Still want to test this in code with a workspace with loads of documents to see if it slows down the initial folder search.

case (true, _) => ResourceFetchMode.Basic
case (false, text) => ResourceFetchMode.WithData(text)
case (false, pt) => ResourceFetchMode.WithData(pt.map(_.query))
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe pc instead of pt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

parsed tchip

@philmcmahon
Copy link
Contributor

This is looking great, would be good to do a playground test just to check for any url weirdness on a proper domain but otherwise code is looking good to me

//Attempt.catchNonFatal {
val parsedQ = Json.parse(q)
// find WorkspaceSearchContextParams
Copy link
Contributor

Choose a reason for hiding this comment

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

it might be worth adding a slightly more detailed comment here explaning what's happening - i.e extracting the workspace parameters, then ignoring them in the next bit

Copy link
Contributor

@philmcmahon philmcmahon left a comment

Choose a reason for hiding this comment

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

cat looking in a folder

Copy link
Contributor

@marjisound marjisound left a comment

Choose a reason for hiding this comment

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

This looks great, thanks for walking me through the PR :)

@hoyla
Copy link
Contributor

hoyla commented Mar 18, 2024

Woohoo!

@zekehuntergreen zekehuntergreen merged commit 4625fa9 into main Mar 18, 2024
1 check passed
@zekehuntergreen zekehuntergreen deleted the search-in-workspace-folder branch March 18, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants