log.debug("Rewrote input '{}' to '{}'", input, output); return compressWhitespace(output);
/** * Returns a parsed version of the input. * * @param input the user input * @param allowSingleNonLeadingWildCardPerTerm if there is allowed one wildcard (* or ?) per term (however, still * not allowed as leading for a term) * @param ignore the chars that should not be parsed * @param retainWordBoundaries whether to retain characters such as ~ & ! when they appear in a * token as word boundaries or remove them, see also * {@link #isSpecialChar(char)} * @return the parsed version of the <code>input</code>. When <code>input</code> is <code>null</code>, * <code>null</code> is returned */ public static String parse(final String input, final boolean allowSingleNonLeadingWildCardPerTerm, final char[] ignore, final boolean retainWordBoundaries) { if (input == null) { return null; } String parsed = EncodingUtils.foldToASCIIReplacer(input); parsed = compressWhitespace(parsed); parsed = removeInvalidAndEscapeChars(parsed, allowSingleNonLeadingWildCardPerTerm, ignore, retainWordBoundaries); parsed = removeLeadingOrTrailingOrOperator(parsed); parsed = rewriteNotOperatorsToMinus(parsed); parsed = removeLeadingAndTrailingAndReplaceWithSpaceAndOperators(parsed); log.debug("Rewrote input '{}' to '{}'", input, parsed); return parsed; }