@NotNull
    public static Predicate<String> createCaseInsensitiveEndsWithPredicate(final String userInput) {
        LOGGER.trace("Creating case insensitive ends with predicate");
        final String lowerCaseInput = userInput.toLowerCase();
        return toNullSafePredicate(false, stringUnderTest ->
                stringUnderTest.toLowerCase().endsWith(lowerCaseInput));
    }
For a given user input this method will return a function that can evaluate a string to see how
good the match is. The quality of the match is determined by the length of the matched region
(shorter == better) and its distance from the start of the string (closer == better).
stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/StringPredicateFactory.java