Fix "search" query to use library_id. Unfortunately this will slow it
down due to the required relations.