com.gisgraphy.helper
Class StringHelper
java.lang.Object
com.gisgraphy.helper.StringHelper
public class StringHelper
- extends java.lang.Object
Provide some usefull method to copute strinfg for autocompletion and fulltextsearch
- Author:
- David Masclet
Method Summary |
static java.lang.String |
transformStringForFulltextIndexation(java.lang.String originalString)
Process a string to apply filter as lucene and solr does :
- remove accent
- lowercase
- word delimiter ('-', '.' |
static java.lang.String |
transformStringForPartialWordIndexation(java.lang.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 java.lang.String |
transformStringForPartialWordSearch(java.lang.String originalString,
char delimiter)
|
static OpenStreetMap |
updateOpenStreetMapEntityForIndexation(OpenStreetMap openStreetMap)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MAX_STRING_INDEXABLE_LENGTH
public static final int MAX_STRING_INDEXABLE_LENGTH
- See Also:
- Constant Field Values
WHITESPACE_CHAR_DELIMITER
public static final char WHITESPACE_CHAR_DELIMITER
- See Also:
- Constant Field Values
logger
protected static final org.slf4j.Logger logger
StringHelper
public StringHelper()
transformStringForFulltextIndexation
public static final java.lang.String transformStringForFulltextIndexation(java.lang.String originalString)
- Process a string to apply filter as lucene and solr does :
- remove accent
- lowercase
- word delimiter ('-', '.'
- Parameters:
originalString
- the string to process
- Returns:
- the transformed String or null if the original String is null
transformStringForPartialWordIndexation
public static final java.lang.String transformStringForPartialWordIndexation(java.lang.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.
- Parameters:
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;
- Returns:
- the transformed String (or null if the original String is null) to be used by the postgres function to_ts_vector
- See Also:
transformStringForPartialWordSearch(String, char)
transformStringForPartialWordSearch
public static final java.lang.String transformStringForPartialWordSearch(java.lang.String originalString,
char delimiter)
- Parameters:
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
- Returns:
- the transformed string (or null if the original String is null) to be use by the postgres function plainto_tsquery)
- See Also:
transformStringForPartialWordIndexation(String, char)
updateOpenStreetMapEntityForIndexation
public static OpenStreetMap updateOpenStreetMapEntityForIndexation(OpenStreetMap openStreetMap)
- Parameters:
openStreetMap
- the openStreetMap Entity to update
- Returns:
- the same openstreetmap entity with the
OpenStreetMap.PARTIALSEARCH_COLUMN_NAME
and OpenStreetMap.FULLTEXTSEARCH_COLUMN_NAME
Copyright © 2010. All Rights Reserved.