/** * Returns a parsed version of the input. * * Calls <code>#parse(input, allowSingleNonLeadingWildCardPerTerm, maxLength, null, true)</code> * * @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 maxLength the maxLength of the returned parsed input * @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, int maxLength) { return parse(input, allowSingleNonLeadingWildCardPerTerm, maxLength, null/*ignore*/, true); }
/** * 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) * @return the parsed version of the <code>input</code>. When <code>input</code> is <code>null</code>, * <code>null</code> is returned * * Calls <code>#parse(input, allowSingleNonLeadingWildCardPerTerm, null, true)</code> */ public static String parse(final String input, final boolean allowSingleNonLeadingWildCardPerTerm) { return parse(input, allowSingleNonLeadingWildCardPerTerm, null/*ignore*/, true); }
/** * Returns a parsed version of the input. * * Calls <code>#parse(input, allowSingleNonLeadingWildCardPerTerm, ignore, true)</code> * * @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 * @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) { return parse(input, allowSingleNonLeadingWildCardPerTerm, ignore, true); }
/** * Returns a parsed version of the input. * * Calls <code>#parse(input, allowSingleNonLeadingWildCardPerTerm, null, retainWordBoundaries)</code> * * @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 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 boolean retainWordBoundaries) { return parse(input, allowSingleNonLeadingWildCardPerTerm, null/*ignore*/, retainWordBoundaries); }
/** * Returns a parsed version of the input. * * Calls <code>#parse(input, allowSingleNonLeadingWildCardPerTerm, maxLength, ignore, true)</code> * * @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 maxLength the maxLength of the returned parsed input * @param ignore the chars that should not be parsed * @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 int maxLength, final char[] ignore) { return parse(input, allowSingleNonLeadingWildCardPerTerm, maxLength, ignore, true); }
@Nullable public String cleanupSearchQuery(final String query) { return SearchInputParsingUtils.parse(query, false); }
/** * 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 maxLength the maxLength of the returned parsed input * @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 int maxLength, final char[] ignore, final boolean retainWordBoundaries) { if (input == null) { return null; } String parsed = parse(input, allowSingleNonLeadingWildCardPerTerm, ignore, retainWordBoundaries); if (parsed.length() > maxLength) { parsed = parsed.substring(0, maxLength); } log.debug("Rewrote input '{}' to '{}'", input, parsed); return parsed; }