mbleigh / acts-as-taggable-on

A tagging plugin for Rails applications that allows for custom tagging along dynamic contexts.
http://mbleigh.lighthouseapp.com/projects/10116-acts-as-taggable-on
MIT License
4.95k stars 1.18k forks source link

Use eq instead of matches for non-wildcard searches #1101

Open flickgradley opened 1 year ago

flickgradley commented 1 year ago

Context:

Thanks for such an excellent gem! We have over 60,000 tags in our database, and optimizing the LIKE and ILIKE operators is proving to be difficult. It seems like we don't need to use LIKE/ILIKE when doing exact tag matches (non-wildcard) - this PR changes the matches and matches_any operators to eq and eq_any, which would let us use a BTREE index on lower(name) to optimize these queries. We already use lower(name) when performing a case-insensitive search, so we don't need to use ILIKE as well.

ragingdave commented 9 months ago

@mbleigh any progress on getting this into a new release? It would be hugely helpful