tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
571 stars 99 forks source link

Find assets endpoints (/api/assets) forces substring/partial match in attributes #478

Open discordianfish opened 7 years ago

discordianfish commented 7 years ago

Hi,

I just realize that if you search for an attribute via /api/assets collins wraps the search term with ** forcing partial matches. Even anchoring with ^term$ doesn't work. It looks like collins is converting a search for "attribute=attrib;foo" into ATTRIB:*foo*:.

This is unexpected and hard to work around if you need explicit matches. No anchoring is working, so you need to search the results on the client side again.

Instead, collins should simply not wrap the term in **. This way people can use the wildcards where necessary while defaulting to full string match.

discordianfish commented 7 years ago

Actually anchoring is working. Had an unrelated issue. Still, matching on substring by default seems an odd choice. Any chances this will be changed?

william-richard commented 7 years ago

Yeah, I agree that matching on substrings by default is a strange choice. I have no idea why it was made, and it's actually caused a few bugs for us over the years that I've been using collins. We have discussed changing it, but have been perhaps overly worried that automation is relying upon this functionality, and changing it would have unexpected consequences. It is worth having a discussion about, and perhaps changing when we do the next major, non-backwards compatible release.