docfx
docfx copied to clipboard
feat!: search improvements
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 forManaged
I will get no results. Same goes forManagedReference
- 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
- For example, if I have a page
- 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
andSummary
inManifestProperties
- Stores
- Search Index
- Includes new property
summary
- Entries for MREFs can be loaded from metadata instead of HTML scrapping
- Includes new property
-
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)
- Parses through the symbol's full name and creates permutations of the words found
- 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