rust-search-extension icon indicating copy to clipboard operation
rust-search-extension copied to clipboard

Search should be case sensitive

Open Victor-N-Suadicani opened this issue 1 year ago • 4 comments

Expected Behaviour

  1. I type in rs Eq.
  2. I hit enter.
  3. I am taken to the docs for std::cmp::Eq.

Actual Behaviour (on Firefox for me at least)

  1. I type in rs Eq.
  2. I hit enter.
  3. I am taken to the docs for std::ptr::eq.

This seems undesirable.

Victor-N-Suadicani avatar Sep 05 '22 08:09 Victor-N-Suadicani

Hi @Victor-N-Suadicani. Thanks for the feedback. I personally think case-sensitive has more disadvantages than advantages. For example, most traits, and structs are CamlCase, the users prefer to input lowercase keywords to search it, such as refcell for RefCell.

So, I still insist on the case-insensitive search experience.

Folyd avatar Sep 05 '22 11:09 Folyd

I think the proper solution would be to weigh exact (case-sensitive) matches higher, but still find the other (case-insensitive) matches.

As in, rs Eq would still find both std::ptr::eq and std::cmp::Eq but Eq should be at the top because it matches exactly, while eq does not. Then searching refcell would still find RefCell (since there is nothing called refcell, RefCell would still be at the top).

Victor-N-Suadicani avatar Sep 05 '22 13:09 Victor-N-Suadicani

Good idea. Thanks.

Folyd avatar Sep 05 '22 14:09 Folyd

You could also implement smart case search where if you type an upper case character in the query, it enables case sensitivity in the search, otherwise treats it as case-insensitive.

This way it doesn't require exact matches and it's easier to find case-sensitive partial matches (like Once => OnceCell).

13k avatar Apr 06 '23 19:04 13k