Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

[search] add ability to filter results to current site versus all docs - #138

Merged
katydecorah merged 4 commits into
masterfrom
search-filter
Jun 3, 2019
Merged

katydecorah merged 4 commits into
masterfrom
search-filter

Conversation

@katydecorah

Copy link
Copy Markdown
Contributor

If you set the site prop, 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.

image

image

How to test:

  1. npm run start
  2. Navigate to http://192.168.7.223:9966/Search
  3. Try the second test case: "Basic search with site set to show filter toggle"

@katydecorah
katydecorah requested a review from a team June 3, 2019 13:37
@katydecorah

Copy link
Copy Markdown
Contributor Author

Note: I'm seeing an zIndex fight with the modal and topbar sticker. Going to fix in another PR.

@colleenmcginnis

colleenmcginnis commented Jun 3, 2019 •

Copy link
Copy Markdown
Contributor

@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 docs.mapbox.com/{THIS_PART}?

@katydecorah

Copy link
Copy Markdown
Contributor Author

@colleenmcginnis it's filtering based on the value of site in Swiftype. We setsite via the page shell: https://github.com/mapbox/api-documentation/blob/publisher-production/src/components/page-shell.js#L105 which creates the Swiftype meta tag.

values = []
}) => {
const value = values[0];
const siteFilter = options.filter(opt => opt.value === this.props.site)[0];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh thanks @katydecorah! 💡

@HeyStenson

Copy link
Copy Markdown
Contributor

This looks awesome @katydecorah! Ability to filter by the site they're on will be a great addition to the user experience.

@colleenmcginnis colleenmcginnis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?

@katydecorah

Copy link
Copy Markdown
Contributor Author

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.

@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 colleenmcginnis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Katy DeCorah added 2 commits June 3, 2019 19:07
* master:
  increase modal zindex to prevent collision with topbar sticker (#139)
@katydecorah
katydecorah merged commit c45ca46 into master Jun 3, 2019
@katydecorah
katydecorah deleted the search-filter branch June 3, 2019 23:11
katydecorah pushed a commit that referenced this pull request Jun 4, 2019
* master:
  [search] add ability to filter results (#138)
  increase modal zindex to prevent collision with topbar sticker (#139)
katydecorah pushed a commit that referenced this pull request Jun 4, 2019
* master:
  [search] add ability to filter results (#138)
katydecorah pushed a commit that referenced this pull request Jun 5, 2019
* master:
  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)
katydecorah pushed a commit that referenced this pull request Jun 5, 2019
* 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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants