Cargo cult copy of SQL from PHP to get search test working properly
Extract methods
Update cache before outputting feed

As noted in the code comment, this probably isn't needed with the
Rails code because we correctly update this cache when changes happen.
Deprecated functions raise an error now
Merge pull request #265 from openaustralia/issue264

Fix remaining 'compare' calls