public class StringHelper extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
static int |
MAX_STRING_INDEXABLE_LENGTH |
static char |
WHITESPACE_CHAR_DELIMITER |
Constructor and Description |
---|
StringHelper() |
Modifier and Type | Method and Description |
---|---|
static String |
getStackTraceAsString(Throwable aThrowable) |
static boolean |
isEmptyString(String string)
Usefull method to be compatible with jdk1.5 (jdk 1.6 already have this method)
|
static boolean |
isNotEmptyString(String string)
Usefull method to be compatible with jdk1.5 (jdk 1.6 already have this method)
|
static String |
normalize(String originalString)
Process a string to apply filter as lucene and solr does :
- remove accent
- lowercase
- word delimiter ('-', '.'
|
static String |
splitCamelCase(String s) |
static String |
transformStringForPartialWordIndexation(String originalString,
char delimiter)
Process a string to in order to be stored in a specific postgres
field to allow the index usage for ilike (ilike(%String%):
e.g : 'it s ok'=> s ok, s o, it s, t s o, t s, it s ok, ok, it s o, it, t s ok
it remove duplicates and don't put single character.
|
static String |
transformStringForPartialWordSearch(String originalString,
char delimiter) |
static OpenStreetMap |
updateOpenStreetMapEntityForIndexation(OpenStreetMap openStreetMap) |
public static final int MAX_STRING_INDEXABLE_LENGTH
public static final char WHITESPACE_CHAR_DELIMITER
protected static final org.slf4j.Logger logger
public static final String normalize(String originalString)
originalString
- the string to processpublic static final String transformStringForPartialWordIndexation(String originalString, char delimiter)
originalString
- the string to processdelimiter
- words will be delimited by this char
(it should be the same as the one in transformStringForPartialWordSearch(String, char)
.
For gisgraphy the char is WHITESPACE_CHAR_DELIMITER
IMPORTANT NOTE : if the string is greater than MAX_STRING_INDEXABLE_LENGTH
, the method will return null;transformStringForPartialWordSearch(String, char)
public static final String transformStringForPartialWordSearch(String originalString, char delimiter)
originalString
- the string to transformdelimiter
- the delimiter
(it should be the same as the one use in transformStringForPartialWordIndexation(String, char)
)
For gisgraphy the char is WHITESPACE_CHAR_DELIMITER
transformStringForPartialWordIndexation(String, char)
public static OpenStreetMap updateOpenStreetMapEntityForIndexation(OpenStreetMap openStreetMap)
openStreetMap
- the openStreetMap Entity to updateOpenStreetMap.FULLTEXTSEARCH_COLUMN_NAME
public static String splitCamelCase(String s)
s
- a camel Case stringpublic static boolean isNotEmptyString(String string)
string
- the string to testpublic static boolean isEmptyString(String string)
string
- the string to testCopyright © 2015. All rights reserved.