carmen-ruby/carmen

Carmen::Querying::named case-sensitivity

Closed this issue · 2 comments

Hi, Jim.

I’m in the process of upgrading our application which very successfully uses Carmen 0.2.12 to 1.0.0b2 (and I will probably have some pull requests forthcoming), and I quite accidentally stumbled upon (yay unit tests) the fact that Carmen::Querying::named is case sensitive, where the 0.2.x methods were not.

I suspect this is because case-folding Unicode characters is a tricky business.

The unicode_utils gem could help greatly with this, but it is limited to Ruby 1.9, and I wanted to talk to you about the issue before I submitted a pull request that adds a gem dependency.

What are your thoughts on the matter?

jim commented

I agree that it would be nice if named was case-insensitive. It probably makes sense for coded to also ignore case.

One thing I did find with the old version is that what a lot of users really want is a way to do fuzzy finding (I assume for things such as autocompletes?) I think it would be better to have a search method that is distinct from named to cover cases such as these.

There is an old pull request related to this. I didn't merge it because I consider the old behavior of looking for an exact match and then falling back to a fuzzy search to have been a mistake.

I'm not sure how relevant that is to what you're working on, but in any case, I would welcome the case improvements you are suggesting. Having another gem dependency is OK.

Great. I said I wanted to discuss it with you, but I went ahead and implemented it yesterday afternoon before I saw your reply. I saw the :fuzzy option in the comments, so I implemented that as a straight substring search.

I just submitted a pull request, which opened yet another issue. But I agree with you about the fuzzy fallback. It was the main motivation for us forking this repo in the first place. ;-`>