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

Methods not showing up in search results #330

Closed
p8 opened this issue Oct 11, 2023 · 2 comments · Fixed by #343
Closed

Methods not showing up in search results #330

p8 opened this issue Oct 11, 2023 · 2 comments · Fixed by #343

Comments

@p8
Copy link
Member

p8 commented Oct 11, 2023

When I search for render I'm not seeing any render methods in the results:
image

@jonathanhefner
Copy link
Member

Modules are ranked above methods in search results. This is because there are "escape hatches" to search for methods, but no equivalent escape hatch for modules. Try searching for "#render", ".render", or "render(":

results

I've submitted #331 to add a tip about this.

jonathanhefner added a commit to jonathanhefner/sdoc that referenced this issue Oct 25, 2023
Prior to this commit, modules would rank above methods in search
results.  This ensured, for example, that `ActionController::Rendering`
would rank above `ActionController::Rendering#render` when searching for
"ActionController::Rendering".  However, `ActionController::Rendering`
would also rank above `ActionController::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 above
`ActionController::Rendering#render` when searching for
"ActionController::Rendering", but `ActionController::Rendering#render`
now ranks above `ActionController::Rendering` when searching for just
"render".

Fixes rails#330.
@jonathanhefner
Copy link
Member

After some more thought, I think I have found a good compromise: #343.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants