WIP: pkg/search: generic queries for camliRoot and relation

Start using them in the publish handler, to ease the move to a
possibly stand-alone publish handler.

Context: http://camlistore.org/issue/365

Change-Id: I2781a345e024174e3bea8511b6cdc6f342d5a7c1