Class StorageUtils
java.lang.Object
org.exoplatform.social.core.storage.impl.StorageUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final DateTimeFormatter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapeJsonValue(String value) Escapes a value written between the quotes of a JSON string of a query built as text, so that a quote, a backslash or a control character in the value reaches Elasticsearch as that character.static StringescapeSearchText(String text) Escapes a searched text for the JSON string of an analyzed query:normalizeSearchText(String)thenescapeJsonValue(String).static StringfillQueryTemplate(String template, Map<String, String> values) Fills a query template in one pass: each@name@placeholder of the template is replaced by its value, and a placeholder's name found inside a value, such as a searched@limit@, is written as is.static StringnormalizeSearchText(String text) Prepares a searched text for an analyzed Elasticsearch query (a match query): the Latin combining diacritics are removed, as the index analyzers' asciifolding does, because the ngram fields' search analyzer (space display name, category name) folds nothing.static DateparseRFC3339Date(String dateString) static <T> List<T> Gets sub list from the provided list with start and end index.static StringtoRFC3339Date(Date dateTime)
-
Field Details
-
ASTERISK_STR
- See Also:
-
EMPTY_STR
- See Also:
-
RFC_3339_FORMATTER
-
-
Constructor Details
-
StorageUtils
public StorageUtils()
-
-
Method Details
-
subList
Gets sub list from the provided list with start and end index.- Parameters:
list- the identity liststartIndex- start index to gettoIndex- end index to get- Returns:
- sub list of the provided list
-
toRFC3339Date
-
parseRFC3339Date
-
normalizeSearchText
Prepares a searched text for an analyzed Elasticsearch query (a match query): the Latin combining diacritics are removed, as the index analyzers' asciifolding does, because the ngram fields' search analyzer (space display name, category name) folds nothing. The text is decomposed (NFD) to find them and recomposed (NFC) afterwards, so that a Hangul syllable or a kana with a sound mark, which NFD also decomposes, is searched as typed. Nothing else is changed: the field's search analyzer splits the text into the tokens the index holds, and a text with no token matches nothing.- Parameters:
text- searched text, as typed- Returns:
- the text to search, trimmed;
nullwhen the text is null
-
escapeJsonValue
Escapes a value written between the quotes of a JSON string of a query built as text, so that a quote, a backslash or a control character in the value reaches Elasticsearch as that character.- Parameters:
value- value to write- Returns:
- the escaped value,
nullwhen the value is null
-
escapeSearchText
Escapes a searched text for the JSON string of an analyzed query:normalizeSearchText(String)thenescapeJsonValue(String).- Parameters:
text- searched text, as typed- Returns:
- the text to write between the quotes of the query JSON string
-
fillQueryTemplate
Fills a query template in one pass: each@name@placeholder of the template is replaced by its value, and a placeholder's name found inside a value, such as a searched@limit@, is written as is. A placeholder the values do not name is replaced by an empty string.- Parameters:
template- query template holding@name@placeholdersvalues- value of each placeholder, by name without the@- Returns:
- the filled query
-