Description
The TagsProcessor class allows you to extract and process search tags from objects.
Important points
- The search tags can be kept individually or embedded as hash tags inside text. E.g. “This text has #hash_tag that can be used for search.”
Static methods
compressTagList
Compresses a comma-separated list of tags.
public staticListcompressTagList(String tagList)
- tagList: String - comma-separated list of tags to compress.
- returns: List
- list with compressed tags.
compressTags
Compresses a list of tags.
public staticListcompressTags(List tags)
- tags: List
- tag to compress. - returns: List
- list of compressed tags.
equalTags
Compares two tags using their compressed form.
public staticBoolean equalTags(String tag1, String tag2)
- tag1: String - first tag.
- tag2: String - second tag.
- returns: Boolean - true if the tags are equal and false otherwise.
extractHashTags
Extracts hash tags from a text.
public staticListextractHashTags(String text)
- text: String - text that contains hash tags
- returns: List
- list with extracted and compressed tags.
extractHashTagsFromValue
Extracts hash tags from selected fields in an object.
public staticListextractHashTagsFromValue(Object obj, List searchFields)
- obj: Object - object which contains hash tags.
- searchFields: List
- list of fields in the objects where to extract tags - returns: List
- list of extracted and compressed tags.
normalizeTag
Normalizes a tag by replacing special symbols like ‘_’ and ‘#’ with spaces. When tags are normalized, they are presented in similar shape and form.
public staticListnormalizeTags(List tags)
- tag: List
- tag to normalize. - returns: List
- normalized tag.
normalizeTagList
Normalizes a comma-separated list of tags.
public staticListnormalizeTagList(String tagList)
- tagList: String - comma-separated list of tags to normalize.
- returns: List
- list with normalized tags.
normalizeTags
Normalizes a list of tags.
public staticListnormalizeTags(List tags)
- tags: List
- tags to normalize. - returns: List
- list with normalized tags.