Tests for search [skip ci]
Some refactoring.