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

Improve handling of camelCase and snake_case when searching documentation #412

Open
MaddyGuthridge opened this issue Jul 11, 2022 · 2 comments

Comments

@MaddyGuthridge
Copy link

Problem Description

When I am searching for the documentation for a function, say fooBarFunction(), I will often type foo bar function into the search box in order to save time. When I do this, the function will often be significantly lower in the results list, even if what I have typed is an exact match (excluding the way words are split).

Proposal

Searching for a function using multiple words should prioritise functions with that exact name, even if the function uses a different capitalisation convention to the search query.

Additional context

The correct result is 7th in the list
image

If I have time, I'll be happy to work on a PR for this.

@mhils
Copy link
Member

mhils commented Jul 11, 2022

I'll say I'm a big snake_case fan, but I'm happy to merge a PR for this if it's straightforward to implement. :)

@tristanlatr
Copy link

Hi, we had the exact same issue with pydoctor (for search indexing and also for better line wrapping).

We ended-up indexing the splited the name as well.

Here's the code that splits camelCase or snake_case name identifiers:
https://github.com/twisted/pydoctor/blob/0f2c5caee2f3b41ccc2943181086af5e00c0309d/pydoctor/epydoc2stan.py#L841

Tests can be found here: https://github.com/twisted/pydoctor/blob/0f2c5caee2f3b41ccc2943181086af5e00c0309d/pydoctor/test/test_epydoc2stan.py#L1508-L1544

Fell free to use this ;-)

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

No branches or pull requests

3 participants