Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: search improvements #10113

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

frarees
Copy link
Contributor

@frarees frarees commented Jul 15, 2024

Motivation

DocFX's current state of the search functionality has some flaws:

  • Searching through APIs can yield no results unless you type the complete symbol name
    • For example, if I have a page ManagedReferenceExample and I search for Managed I will get no results. Same goes for ManagedReference
    • This is specially important for API pages, since one of the reasons users want to use the search functionality is because they've forgotten the full name of a member
  • Searching multiple terms doesn't narrow the search, but the opposite
  • When I finish inputting my search query, I press Enter instinctively, which clears the search and reloads the page

What has changed

  • New global metadata keys _searchIndexUseMetadata and _searchIndexUseMetadataTitle to opt-in
  • New build step for MREFs: FillMetadata
    • Stores Title and Summary in ManifestProperties
  • Search Index
    • Includes new property summary
    • Entries for MREFs can be loaded from metadata instead of HTML scrapping
  • SearchIndexItem.Keywords holds different content for MREFs
    • Parses through the symbol's full name and creates permutations of the words found
      • ManagedReferenceExample -> Managed ManagedReference ManagedReferenceExample ManagedExample Reference ReferenceExample Example
    • Keywords is still present and it's used to store exclusively for keywords, and processed by the search engine
    • Summary is rendered by the themes (brief)
  • Modern theme
    • Don't allow Enter/Submit on search
    • Search is additive: searching multiple terms uses AND instead of OR

Notes / TODO

  • The regex used to create keywords, while accounting for most cases, is not perfect
  • Default theme could use similar changes to modern theme, so UX is similar

@yufeih yufeih added the new-feature Makes the pull request to appear in "New Features" section of the next release note label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature Makes the pull request to appear in "New Features" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants