Fix a bug where searching for `sakana~` ranked `sakana~_(meme)` beneath random artist tags containing the word `sakana`. Now, if the search contains punctuation, we rank exact matches first, even for small tags. Before we ranked exact matches for small tags lower than inexact matches for large tags. If the search contains punctuation, it's a strong signal the user is looking for an exact match.
Logical
This directory contains library code used through Danbooru. This includes things like defining API clients, dealing with sources, parsing tag searches, storing and resizing images, and so on.
Many of the files here use the Service Object pattern. Instead of putting complex code in models or controllers, it goes here, in plain old Ruby objects (POROs). This keeps models and controllers simpler, and keeps domain logic isolated and independent from the database and the HTTP request cycle.