Skip to content

RFC: search for keywords in any order #320

@tom93

Description

@tom93

Hi, will you accept a PR to change the behaviour of the Search feature to include results that contain the search patterns in any order?

Currently, if I search for Vector toArray toList on https://leanprover-community.github.io/mathlib4_docs/, I don't get any results. I would like to see Vector.toList_toArray in the results.

There was some old code that did order-independent matching (over the entire docstring), but it was removed in commit 08de0ad. At the moment spaces are removed from the search pattern and have no effect at all.

I propose augmenting the current (fuzzy) search results with declarations that contain exact matches for the words in the search pattern in any order.

For ranking the results, I suggest the following:

  1. Results that contain exact matches for the words in the same order as the pattern (within this group, sort by the fuzzy match error).
  2. Results that contain exact matches in a different order (again sorted by fuzzy match error).
  3. All other results (sorted by fuzzy match error).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions