-
- Notifications
You must be signed in to change notification settings - Fork 750
Description
Search Terms
search, index, boost, relevance
Problem
It's difficult to adjust search boosts now that it can't be done on the reflection level. We used to use relevanceBoost to deemphasize particular declarations. Now it can only be done at the group or category level.
For example, we have "extensions" to our library that should always show up last in searches. We flag these extensions via categories for organization purposes. This means we can use searchCategoryBoosts to deemphasize the extension classes themselves via these categories, but all their members still show up too high in search results as we don't want to categorize every single member.
Another use case would be hiding inherited members from search. We don't want to show the same accessor on each class that inherits it. There's no way to make granular adjustments such as this with just group and category boosts. Here, only GraphObject.width and LayoutVertex.width are relevant, the rest are just inheriting width from those base classes.
Suggested Solution
I think it would make sense to bring back DeclarationReflection.relevanceBoost as a baseline boost (rather than everything starting at 1), then apply searchGroupBoosts and searchCategoryBoosts upon that baseline. This would allow us to set all our "extensions" to a lower baseline (or maybe non-extensions to a higher baseline), then apply the typical boosts, like making classes a higher priority. Or we could set all inherited members to -1 to ensure they aren't shown in the results.
DocumentReflection still seems to have this option, though it's not clear that it's used by the index plugin. https://typedoc.org/api/classes/Models.DocumentReflection.html#relevanceboost