ModMenu
ModMenu copied to clipboard
Add syntax highlighting to searches
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.

In the future, these changes can be used to make various other improvements possible, including:
- Negating search terms (such as
-@libraryto match non-library mod) - Combining content search terms (such as
"Mod Menu"to matchmod menubut notmodormenu) - Searching specific fields (such as
@author:Prospectorto match mods authored by Prospector) - Suggesting search terms
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.
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.
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 #?
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
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
@sin 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"].