Skip to content

[docs-infra] Add capacity to filter the search scope #41541

Open

Description

@oliviernt

Summary

Often when I search for something on the MUI docs through the Algolia search (Strg + K), I'm presented irrelevant search results for the Toolpad components first.

It'd be great to have the ability to exclude products from search.

Examples

Example of the results when searching for "DatePicker"

image

Motivation

No response

Search keywords: search toolpad

Activity

  1. added
    status: waiting for maintainer
    on Mar 18, 2024
  2. changed the title [-]Add search opt-out for MUI products[/-] [+][docs-infra] Add search opt-out for other products[/+] on Mar 18, 2024
  3. added
    type: bug
    scope: docs-infra
    and removed
    status: waiting for maintainer
    on Mar 18, 2024
  4. danilo-leal commented on Mar 18, 2024

    @danilo-leal
    Collaborator

    Hey @oliviernt, thanks for opening the issue! I'm not immediately opposed to your suggestion, but I think there's some bug with the Algolia search ranking that's not suggesting the most relevant page, which, in this case, should be the Date Picker component docs from MUI X instead of Toolpad. @mui/docs-infra, any ideas here?

  5. alexfauquette commented on Mar 18, 2024

    @alexfauquette
    Member

    For some pages, there are filters. For example searchin when you are in a picker docs pages, search query will get the attribute optionalFilters: ["productId:x-date-pickers"]

    Some url such as mui.com don't have those filters, because from it we can not now if user is looking for the core, X, or toolpad docs

    But we could look for lowering the importances of toopads API pages, because if they put one page per components, they will always appear first

  6. oliviernt commented on Mar 18, 2024

    @oliviernt
    Author

    Hey @alexfauquette @danilo-leal, thank you both for your fast response time.

    Lowering the importance of toolpad would indeed, solve my current issue but it could possibly deteriorate the experience for other users.

    My idea was that selecting which products I'm interested in would make a nice feature in itself. It would reduce the search scope, allow for people intereseted in toolpad (or any other product) to select that and make it flexible in the long run as you guys are providing more and more products...

  7. danilo-leal commented on Mar 18, 2024

    @danilo-leal
    Collaborator

    Yeah, I agree that having the option to tailor the search results ranking to your preference would be great! We'd still need a ranking from our side, though, because if you're a new visitor accessing the website for the first time, you wouldn't have a preference just yet. So, considering this specific example, Toolpad's Date Picker docs page shouldn't be the first resource that pops up if you're looking for that.

  8. oliviertassinari commented on Mar 18, 2024

    @oliviertassinari
    Member

    Regression fixed, https://mui.com/ is back to the baseline:

    SCR-20240319-bqxk

    Details. When I do the search of @oliviernt's query "date picker" in the Agolia's UI, it tells me that pageRank is the tie-breaker:

    SCR-20240319-blzf

    https://dashboard.algolia.com/apps/TZGZ85B9TB/explorer/browse/material-ui?query=DatePicker&page=2&searchMode=search

    Which doesn't make sense to me. Turns out, it's a regression I introduced on a bug I fixed. This change solved the problem:

            // % from https://docs.google.com/spreadsheets/d/1x9uTSMlu4xug2SfHrvr5amZ2HokYBoQaSozHmRRdVqw/edit#gid=907743010
            const baselinePopulartyProductId = {
              material-ui: 83,
    -         "mui-x": 12,
    +         x: 12,
              system: 4,
              "base-ui": 2,
              "joy-ui": 2,
              toolpad: 1,
            };

    https://crawler.algolia.com/admin/crawlers/739c29c8-99ea-4945-bd27-17a1df391902/configuration/edit?testUrl=https%3A%2F%2Fmui.com%2Fx%2Freact-date-pickers%2Fdate-picker%2F&useLogin=true

    It needed to match with:

    export type MuiProductId =
    | 'null'
    | 'base-ui'
    | 'material-ui'
    | 'joy-ui'
    | 'system'
    | 'docs-infra'
    | 'docs'
    | 'x-data-grid'
    | 'x-date-pickers'
    | 'x-charts';
    type MuiProductCategoryId = 'null' | 'core' | 'x';


    Now, I don't think we should close this issue until the larger discussion goes to completion. It's point 3. of #16502. What we could explore:

    1. On the homepage, maybe we should have a clear toggle in the search to select a product, e.g. https://nextjs.org/
    SCR-20240319-bsdg

    AWS

    SCR-20240319-bwov

    MUX https://docs.mux.com/?q=al

    SCR-20240319-bwzm
    1. Should it even be possible to have non Material UI results show in between Material UI ones?
    image

    It feels like it only makes sense for when you are on https://mui.com/, but anytime you go to a product, it should only show that product results. We could make this change:

          customRanking: [
            "desc(weight.pageRank)",
            "desc(weight.level)",
            "asc(weight.position)",
            "desc(weight.popularity)",
          ],
          ranking: [
    +      "filters",
           "words",
    -      "filters",
            "typo",
            "attribute",
            "proximity",
            "exact",
            "custom",
          ],

    but it's kind of strange. Or, we could also make two different searches one with the filter set, and one without, so we would only show one type of results at the time. Or we could just hide all non-product related results, forcing developers to go to each doc. This might be best.

  9. oliviernt commented on Mar 19, 2024

    @oliviernt
    Author

    Thank you for the fix! 🚀

    My personal 2 cents on both points:

    1. for me the ideal solution would be to have a persisted multiple choice select of the product docs I'm searching in.
      As we're working with Material UI, I'm normally nor interested in the BaseUI, JoyUI or Toolpad docs. I do know they exist and I know how to access them if I need to...

    2. I think it's nice to have results related to the seach in there as sometimes it might just be the one piece of advice one missed.

  10. flaviendelangle commented on Mar 19, 2024

    @flaviendelangle
    Member

    It needed to match with:

    Looks like we are missing x-tree-view by the way

  11. changed the title [-][docs-infra] Add search opt-out for other products[/-] [+][docs-infra] Add capacity to filter the search scope[/+] on Mar 19, 2024
  12. moved this to Backlog in Docs-infraon Mar 19, 2024
  13. danilo-leal commented on Mar 19, 2024

    @danilo-leal
    Collaborator

    Given there was a quick fix for the original/more immediate problem, I went ahead and rephrased the issue's title so it reflects the "filter the search scope" feature mentioned above that we'll want to explore at some point to potentially solve the issue more holistically!

  14. added
    type: new feature
    and removed
    type: bug
    on Mar 19, 2024
  15. oliviertassinari commented on Mar 19, 2024

    @oliviertassinari
    Member

    Looks like we are missing x-tree-view by the way

    @flaviendelangle On view-source:https://next.mui.com/x/react-tree-view/ I see:

    <meta name="mui:productId" content="x-tree-view"/><meta name="mui:productCategoryId" content="x"/>
    

    We are good.

  16. flaviendelangle commented on Mar 20, 2024

    @flaviendelangle
    Member
  17. moved this from Backlog to Selected in Docs-infraon Mar 20, 2024
  18. moved this from Selected to Backlog in Docs-infraon Aug 6, 2025
  19. HavishJadav commented on Nov 30, 2026

    @HavishJadav

    I'd like to work on this.

    Plan: add a keyboard-accessible product selector to the docs search modal (Material UI, Joy UI, Base UI, MUI X, Toolpad, and so on) that remembers the selected products across visits. The selection becomes a filter on the Algolia query, and the default stays "all products" so the current behavior doesn't change. I'd cover selecting, clearing, and restoring the scope with interaction tests.

    Happy to adjust the UI if the docs-infra team has a preferred design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: docs-infratype: new feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions