ModMenu icon indicating copy to clipboard operation
ModMenu copied to clipboard

Add syntax highlighting to searches

Open haykam821 opened this issue 3 years ago • 6 comments

This pull request refactors the search functionality to allow for more dynamic and highlighted searches. In particular, keywords must now be prefixed with @, and complete keywords will be colored to match their badge if they are associated with one.

image

In the future, these changes can be used to make various other improvements possible, including:

  • Negating search terms (such as -@library to match non-library mod)
  • Combining content search terms (such as "Mod Menu" to match mod menu but not mod or menu)
  • Searching specific fields (such as @author:Prospector to match mods authored by Prospector)
  • Suggesting search terms

haykam821 avatar Nov 05 '22 00:11 haykam821

This is really cool! I'm worried about the change of search behavior though. We need to teach users to prepend the @ and that they now must use the full keywords.

jackassmc avatar Nov 20 '22 12:11 jackassmc

Ideally, the syntax highlighting would be supplanted by suggestions akin to commands. The library button could also just add or remove @library from the search terms.

I think this change actually improves discovery overall. Previously, adding a filter was easy to do accidentally and could even hide mods that would otherwise match the search terms. Now, a correct search term is prefixed by the @ symbol and is highlighted to indicate to the user that it does something.

In the end, search terms are a power user tool and I think that after the proposed changes, their discoverability will be suitable.

haykam821 avatar Nov 20 '22 15:11 haykam821

This is a really cool feature!

I have one question though: Is the usage of @ neccessary, or could that be changed to something more familiar like #?

Sollace avatar Mar 09 '24 02:03 Sollace

This is a really cool feature!

I have one question though: Is the usage of @ neccessary, or could that be changed to something more familiar like #?

It's like @s in commands

Jab125 avatar Jun 26 '24 02:06 Jab125

This is a really cool feature! I have one question though: Is the usage of @ neccessary, or could that be changed to something more familiar like #?

It's like @s in commands

Selectors in a command aren't really the same as tags in a search though. I'm looking at this from the perspective of someone who's used to search engines like twitter or mastodon where terms/categories/concepts use #tags and individuals use @handles .

Using command syntax for something that's not a command, to filter for things that are not selectors, is just going to confuse matters.

If you really want to lean into the command-like syntax, then you shouldn't have searches like @library @author:Prospector. It should instead be @library[author="Prospector"].

Sollace avatar Jun 26 '24 14:06 Sollace