Adjust module vs method ranking in search results #343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit, modules would rank above methods in search results. This ensured, for example, that
ActionController::Rendering
would rank aboveActionController::Rendering#render
when searching for "ActionController::Rendering". However,ActionController::Rendering
would also rank aboveActionController::Rendering#render
when searching for just "render". Though the method does rank first when searching for "#render" or ".render", such queries may not be intuitive.Based on the idea that users will be searching for either a module or a method, this commit removes the higher-ranked module-specific ngrams from method entries in the search index. For example, the method entry for
ActionController::Rendering#render
will no longer include the ":Ac", " Ac", ":Re", and " Re" ngrams (though it will still include the "Act", "Ren", etc ngrams).Furthermore, this commit changes the tie-breaker bonuses to be reduced in proportion to just the method name for methods or the module name for modules, whereas before it was reduced in proportion to the fully qualified name for both methods and modules.
The end result is that
ActionController::Rendering
still ranks aboveActionController::Rendering#render
when searching for "ActionController::Rendering", butActionController::Rendering#render
now ranks aboveActionController::Rendering
when searching for just "render".Fixes #330.