Some tidying up prompted by rubocop cyclomatic complexity warning
Unravel SQL literal a bit to reduce line length

but increased method length, so increase rubocop method length limit.
Ensure that this directory exists

Rails attempts to write the structure.sql file here when migrations are run
so the directory needs to exist.
Disable Style/SingleLineBlockParams

dont think we want to enforce block params |a, e| for all #inject calls, do we?
Disable Style/RedundantSelf cop
Avoid perl-style backref

I agree these are potentially confusing syntax and easily missed
Simplify SearchIndex#search