Repository navigation
[search] add ability to filter results to current site versus all docs - #138
Conversation
|
Note: I'm seeing an zIndex fight with the modal and topbar sticker. Going to fix in another PR. |
|
@katydecorah I'm getting a little lost in this code. Would the filtered option always be equal to the part of the url that comes after |
|
@colleenmcginnis it's filtering based on the value of |
| values = [] | ||
| }) => { | ||
| const value = values[0]; | ||
| const siteFilter = options.filter(opt => opt.value === this.props.site)[0]; |
There was a problem hiding this comment.
@colleenmcginnis to further illustrate:
Swiftype provides a list of unique values stored for the field site this function filters to find the site prop we send the to Search component. In this case we're looking for the value API. Then we can use the data from Switype to create the "API" toggle.
|
This looks awesome @katydecorah! Ability to filter by the site they're on will be a great addition to the user experience. |
colleenmcginnis
left a comment
There was a problem hiding this comment.
@katydecorah thanks for helping my navigate the code!
I think this makes sense, but something to consider is that by filtering results on pages in repos other than /help will prevent results from /help from showing up. Tutorials and troubleshooting guides in /help may be very relevant, and I'm not sure users will realize that choosing iOS (for example) will mean only docs.mapbox.com/ios/* pages and will not include tutorials or troubleshooting guides related to iOS products.
@katydecorah any thoughts on this hypothesis or how to test it?
@colleenmcginnis This is a limitation that I don't think we have a solution right now. We could watch the metrics to see if this is a problem (for example if users are searching on iOS and Android and there's an elevated number of search exits and/or no results returned). |
colleenmcginnis
left a comment
There was a problem hiding this comment.
We could watch the metrics to see if this is a problem (for example if users are searching on iOS and Android and there's an elevated number of search exits and/or no results returned).
👍 Sounds like a plan!
* master: increase modal zindex to prevent collision with topbar sticker (#139)
* master: [search] add ability to filter results (#138)
* master: add snapshot tests (#136) 0.15.1 Prepare 0.15.1 0.15.0 Prepare 0.15.0 [search] adds segment tracking for queries and clicks (#140) [search] add ability to filter results (#138) increase modal zindex to prevent collision with topbar sticker (#139) 0.14.0 Prepare 0.14.0 [PageLayout/TopbarSticker] increase zIndex (#134) [search] Introduce search modal (#133) prepare 0.13.0 adjust version-sort for XX.XX.XX format (#132)
If you set the
siteprop, it will add a toggle at the top of the results so that the user can filter results for the current site or across all docs.Unfortunately, we cannot default the toggle to the current site (waiting for sticky filters upstream in search-ui). Without sticky filters, any filter we set manually gets reset when the user searches. Hopefully we'll be able to add this in the near future.
How to test:
siteset to show filter toggle"