class HerdSearchQueryHelper {

    public String extractSearchPhrase(final IndexSearchRequest indexSearchRequest)
    {
        final Matcher regexMatcher = getNegationTermMatcher(indexSearchRequest);

        String searchPhrase = indexSearchRequest.getSearchTerm();

        while (regexMatcher.find())
        {
            // extract all matches and remove them from the original search phrase
            searchPhrase = searchPhrase.replace(regexMatcher.group(), StringUtils.EMPTY);
        }

        return searchPhrase.trim();
    }

}