fix bug and write spec to test tag_search