refactored stringmatcher query