Automattic / Automattic/jetpack

Instant Search: add filter count support to the API

Open
#14,436 0 comments 1 reaction 0 assignees View on GitHub
[Feature] Search Enhancement
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

When setting up the Instant Search widget, the user is able to choose a maximum number of filter options to be shown:

Screen Shot 2020-01-23 at 14 41 45

We currently enforce this by reversing the filter options returned from the API, and slicing off the first `x` filters to match the value chosen by the user.

https://github.com/Automattic/jetpack/blob/master/modules/search/instant-search/components/search-filter.jsx#L120

It would be better if this was provided as a parameter to the API and the endpoint only returned that number of filter options.

Contributor guide

Open the contributing guide

Research direction

Start with modules/search/instant-search/components/search-filter.jsx around line 120, then trace how the Instant Search widget requests filter options from the API. The work is complete when the API accepts the selected maximum filter count and returns only that many options, removing the need for the client-side reversal and slicing described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php, react
Domain
api, frontend, search
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.