Add language facet to blob search result page - Front End
This is step 5 of the Add search filtering by programming language
epic (full plan is detailed in the epic).
Acceptance Criteria
-
When viewing the results of a search, user is able to see language facets in the left sidebar based on the result set -
User is able to select multiple language facets to apply and update the results -
Each language option will display the number of results that match that language -
Options will be sorted by number of results – most to least. -
Option selection should be linkable (URL should include selections) -
Show up to 10 language options initially. If more exist, include a "Show more" link which then displays the rest that we have fetched in aggregation (we are initially limiting this to 100 – see discussion) -
Include a scrollable max-height on the options list (320px / 20rem) so it doesn't get too long -
If more than 100 language options exist, include note at the bottom of the options list once "Show more" has been selected that indicates we are showing the top 100 language options -
Include telemetry to track usage of language facet (based on effort, also include which options are being used)
#332692 will handle showing the affordance in results as to what language each is (an icon with tooltip).
example format for aggregations that come back in the controller
#<Gitlab::Search::Aggregation:0x00007fbedfc788f0
@buckets=
[{:key=>{"language"=>"C"}, :count=>142},
{:key=>{"language"=>"C++"}, :count=>6},
{:key=>{"language"=>"CSS"}, :count=>1},
{:key=>{"language"=>"CSV"}, :count=>10},
{:key=>{"language"=>"Dockerfile"}, :count=>2},
{:key=>{"language"=>"Gettext Catalog"}, :count=>108},
{:key=>{"language"=>"HTML"}, :count=>9},
{:key=>{"language"=>"HTML+ERB"}, :count=>2},
{:key=>{"language"=>"Haml"}, :count=>36},
{:key=>{"language"=>"JSON"}, :count=>74}],
@name="language">
Release Notes
A programming language facet was added to code search results in Global Search, utilizing Elasticsearch aggregations. The new facet helps narrow the search if you know you only are looking for results in a specific language. The first iteration is available for Advanced Search only.
Edited by Terri Chu