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

Make searches case insensitive #48

Open
ojongerius opened this issue Oct 19, 2017 · 0 comments
Open

Make searches case insensitive #48

ojongerius opened this issue Oct 19, 2017 · 0 comments

Comments

@ojongerius
Copy link
Member

ojongerius commented Oct 19, 2017

We currently do exact matches, hence label "Foo" will not match "foo", but it probably should.

There are a few ways options, and probably more than these:

  • A common approach is to lower or uppercase search string and data. Downside: terrible for performance, the database will do a sequential scan if you call lower()
  • Use the citext module, which supports creating a special index. See https://www.postgresql.org/docs/current/static/citext.html
  • Create indexes based on the lowercase version

Some background around edge cases to be mindful of: https://www.thedroidsonroids.com/blog/edge-cases-to-keep-in-mind-part-1-text

A very simple fix would be to use iexact for queries where case does not matter, from https://docs.djangoproject.com/en/1.11/topics/db/queries/:
Blog.objects.get(name__iexact="beatles blog"), but performance will suffer, most likely, see https://code.djangoproject.com/ticket/3575 for an interesting discussion.

@ojongerius ojongerius changed the title Handle case Make searches case insensitive Oct 19, 2017
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

1 participant