Factor to class SearchCriteria. Implement str _set_bool for templates.

Tests got updated, all pass. Renamed some stuff to increase consistency.
Finish implementing PolicyTemplate. Rename.