Skip to content

Conversation

rafrdz
Copy link
Contributor

@rafrdz rafrdz commented Aug 26, 2025

Summary

In this pull request we're updating search to support queries with spaces in addition to the field:value pattern that is currently supported.

Additionally templates search now defaults to display_name (since display_name is optional the search will fallback to name) when searching without the field:value pattern

Closes: #14384

Downsides with searching on name and display_name

Because the name field cannot include spaces, we end up in a situation where including a space in the query will result in no results since the query searches on both name AND display_name. In the following example, we can see the results of searching by both name and display_name on these templates:

Name Display Name
docker Docker Template
faketemplate A Fake Template
azure Fake Azure Template
anotherfake Another Fake Template
azurefake Another Fake Fake Azure Template
name-and-display-name.mov

Proposal: Search on display_name by default and allow for name using the field:value pattern

If we remove name from the default template search, we're now able to search with spaces on template display_names. Since display_names are what users see in the templates list they might expect the search to work this way.

Below is an example of name being removed from the default template search.

display-name.mov

With this approach users would still be able to search on template names by specifying exact_name:foo.

Testing

Added additional test cases to ensure spaces were handled as expected in combination with field:value patterns.

@rafrdz rafrdz requested a review from Emyrk August 26, 2025 14:33
@rafrdz rafrdz changed the title fix: support spaces in search and search by display name in templates fix: add support for spaces in search and enable searching by display name in templates Aug 26, 2025
@rafrdz rafrdz changed the title fix: add support for spaces in search and enable searching by display name in templates fix: add support for spaces in search & enable searching by display name in templates Aug 26, 2025
@matifali
Copy link
Member

matifali commented Aug 26, 2025

Can we fallback to the name for Templates, when display_name is empty?

@rafrdz
Copy link
Contributor Author

rafrdz commented Aug 26, 2025

Can we fallback to the name for Templates display_name is empty, as it's optional?

To make sure I'm following would you like to search on display_name by default and fallback to name if display_name is empty?

That can be done. Since we would now support spaces in the search queries we'd probably need to update the name query to filter out any spaces since name cannot have any spaces 🤔

@matifali
Copy link
Member

To make sure I'm following would you like to search on display_name by default and fallback to name if display_name is empty?

Yes

@rafrdz
Copy link
Contributor Author

rafrdz commented Aug 26, 2025

To make sure I'm following would you like to search on display_name by default and fallback to name if display_name is empty?

Yes

Sounds good! Defaulting to display_name and falling back to name (with spaces removed from query) in 8c780dc

@matifali
Copy link
Member

Nor directly related but is it possible to stop showing deprecated:false in the search nar?

Can it be a hidden default filter that's always true. If someone wants deprecated templates they can set it to deprecated:true

@rafrdz
Copy link
Contributor Author

rafrdz commented Aug 27, 2025

Nor directly related but is it possible to stop showing deprecated:false in the search nar?

Can it be a hidden default filter that's always true. If someone wants deprecated templates they can set it to deprecated:true

We could remove that from the frontend as the default query and update the query to always return deprecated:false unless a user specifically asked for deprecated:true. The frontend already has a "Deprecated templates" filter that sets deprecated:true.

Should we make a new issue for this work?

@matifali
Copy link
Member

matifali commented Aug 28, 2025

Yes let's create a new issue. Thanks

@github-actions github-actions bot added the stale This issue is like stale bread. label Sep 5, 2025
Copy link
Contributor

@brettkolodny brettkolodny left a comment

Choose a reason for hiding this comment

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

Personally I think the UX of our workspace search needs a bit of an improvement, but I think this is a good solution given what we've got!

Copy link
Contributor

@brettkolodny brettkolodny left a comment

Choose a reason for hiding this comment

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

Thank you!

@rafrdz rafrdz merged commit 1677a30 into main Sep 8, 2025
31 checks passed
@rafrdz rafrdz deleted the rafrdz/templates-search branch September 8, 2025 22:13
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cannot search template name with spaces
3 participants