Class QueryPreprocessor
java.lang.Object
org.opencastproject.elasticsearch.index.QueryPreprocessor
Utility class to preprocess potentially malformed Lucene query strings.
The following sanitations are performed:
- Escape special characters that would potentially lead to malformed queries
- Enable partial search by adding '*' as both prefix and suffix to individual terms
- Exception: Double-quoted terms
- Sanitize use of double quotes by appending a double quote at the end of the sanitized query in case
the closing double quote is missing
- Ensure that + und - are interpreted in a user-friendly way, i.e. test-unit is not interpreted as test -unit
-
Method Summary
-
Method Details
-
sanitize
Sanitize a potentially malformed query string so it conforms to the Lucene query syntax- Parameters:
query- potentially malformed Lucene query string- Returns:
- sanitized query string
-