I've done some research across several existing implementationsβGitHub, SourceGraph, GitLab, ForΔejoβand have a proposal for how we tackle this.
General notes
- Tangled treats issues and pulls as separate concepts with their own unique incrementing numbers. I see no reason to mess with this. Either we are searching issues or we are searching pulls, not both (like GitHub supports).
- I believe we should be inclusive of no-JS users where possible.
GitHub
Textfield with dropdown
Client-side validation
GitHub search uses a relatively normal text field where key:value items are treated differently from regular search keywords. It provides obvious and explicit UI menus for adding common filters. Many others are only accessible by typing them explicitly. There is a JS-driven autocomplete drop-down when you focus the textfield that walks you through configuring all available filters. When it detects you're typing a key:value, keys are autocompleted by typing from the left; values are autocompleted by matching anywhere within the text. -key:value is used for negation, which is recognisable from search engines and tidy. Unfortunately because any typed tag could be a negation, it is difficult to filter out the repeated use of a tag that is nonsensical, e.g., two issue authors. The autocomplete dropdown is sophisticated and intuitive and there is client-side validation if the current filter state doesn't make sense.
Sourcegraph
Search textfield with blocks
Similar to GitHub except that the textfield is much more stylised and key:value pairs become represented as coloured rectangles that are single entity. This enables more efficient editing, e.g. press backspace once to clear a particular key:value filter. They have a sophisticated drop-down, but also a bunch of examples on their search page and lists of values you can filter on. Their product is extremely code-search-centric so it makes sense that they spend a lot of UI complexity on making this as discoverable and efficient as possible.
Gitlab
Textfield with dropdown
Value autocomplete
Gitlab presents a textfield-like search interface but it parses it locally into specific key-value pairs in its query string. Instead of plain text, your key:value settings are represented visually as special blocks: key, = or !=, value. An autocomplete dropdown is again used to help guide your tag selection. I find editing the "rendered" values to be quite fiddly and unintuitive vs. a plain text field.
ForΔejo
Issue search interface
Like Tangled, issues and pulls are separate. Unlike all the other products considered here, non-keyword filters (label, author, etc.) are kept out of the search bar. I don't like this much at allβwhen you're looking at a page of results there is essentially no feedback about what combination of filters are in effect. You have to click on drop-downs and go scrolling to see what's selected. They have implemented some fancy selection logic, e.g. author allows only one selection; meanwhile labels can be grouped such that certain subsets of labels can only have one selected, and this is enforced in the search filter. Oddly, typing multiple keywords seems to be an OR rather than an AND? Overall, not a fan.
Conclusions
A search box containing all filter context and keywords is a solid base to start from, with leading - for negation.
- Explicit feedback to the user what results they're looking at
- Highly extensible - can add more
key:value tags or regex etc. later
- Lots of scope to put a fancy block-builder UI over the top if this is desirable later
- A JS-driven autocomplete dropdown is pretty common for discovering what tags/values are available without cluttering the interface
- Even without a dropdown, a textfield is accessible to a no-JS user who knows what tags are available
These tags could be easily supported as a starting point:
state:open
state:closed
state:merged
author:@handle
label:good-first-issue
What could we do better than GitHub?
One of the things that is great about Tangled is how it tries to be uniquely better than existing code forges. So how could we innovate here?
- Don't be stingy about autompleted values (GitHub seems to limit to 20)
- Try to autocomplete values from first keystroke: so if I click in search and type "goo" then my top suggestion in the dropdown is "label:good-first-issue"
- Be fast: preload values and filter client-side
- Fuzzy/levenshtein matching of values
- Provide an old-school "advanced search" page for no-JS users to select all the key/value parameters they want using traditional HTML form elements
Proposed execution
- Step 1: Augment the search so that use of the tags listed above provides filtered search results
- Step 2: Add a JS drop-down that guides the user in selecting valid tags and values
I've done some research across several existing implementationsβGitHub, SourceGraph, GitLab, ForΔejoβand have a proposal for how we tackle this.
General notes
GitHub
Textfield with dropdown
Client-side validation
GitHub search uses a relatively normal text field where
key:valueitems are treated differently from regular search keywords. It provides obvious and explicit UI menus for adding common filters. Many others are only accessible by typing them explicitly. There is a JS-driven autocomplete drop-down when you focus the textfield that walks you through configuring all available filters. When it detects you're typing akey:value, keys are autocompleted by typing from the left; values are autocompleted by matching anywhere within the text.-key:valueis used for negation, which is recognisable from search engines and tidy. Unfortunately because any typed tag could be a negation, it is difficult to filter out the repeated use of a tag that is nonsensical, e.g., two issue authors. The autocomplete dropdown is sophisticated and intuitive and there is client-side validation if the current filter state doesn't make sense.Sourcegraph
Search textfield with blocks
Similar to GitHub except that the textfield is much more stylised and
key:valuepairs become represented as coloured rectangles that are single entity. This enables more efficient editing, e.g. press backspace once to clear a particularkey:valuefilter. They have a sophisticated drop-down, but also a bunch of examples on their search page and lists of values you can filter on. Their product is extremely code-search-centric so it makes sense that they spend a lot of UI complexity on making this as discoverable and efficient as possible.Gitlab
Textfield with dropdown
Value autocomplete
Gitlab presents a textfield-like search interface but it parses it locally into specific key-value pairs in its query string. Instead of plain text, your
key:valuesettings are represented visually as special blocks:key,=or!=,value. An autocomplete dropdown is again used to help guide your tag selection. I find editing the "rendered" values to be quite fiddly and unintuitive vs. a plain text field.ForΔejo
Issue search interface
Like Tangled, issues and pulls are separate. Unlike all the other products considered here, non-keyword filters (label, author, etc.) are kept out of the search bar. I don't like this much at allβwhen you're looking at a page of results there is essentially no feedback about what combination of filters are in effect. You have to click on drop-downs and go scrolling to see what's selected. They have implemented some fancy selection logic, e.g. author allows only one selection; meanwhile labels can be grouped such that certain subsets of labels can only have one selected, and this is enforced in the search filter. Oddly, typing multiple keywords seems to be an OR rather than an AND? Overall, not a fan.
Conclusions
A search box containing all filter context and keywords is a solid base to start from, with leading
-for negation.key:valuetags or regex etc. laterThese tags could be easily supported as a starting point:
state:openstate:closedstate:mergedauthor:@handlelabel:good-first-issueWhat could we do better than GitHub?
One of the things that is great about Tangled is how it tries to be uniquely better than existing code forges. So how could we innovate here?
Proposed execution