SuggestTagConfig
Configuration object for a lookup of global hashtags. It provides more options to provide more precise suggestions for existing tags.
Methods
addFilterExcludedTags
addFilterExcludedTags(
pFilterExcludedTags):SuggestTagConfig
Adds global tags which must not be present in combination with the suggestions in a record.
Parameters
string[]the excluded tags
Returns
SuggestTagConfigsuggestTagConfig
addFilterIncludedTags
addFilterIncludedTags(
pFilterIncludedTags):SuggestTagConfig
Adds global tags which must be included in combination with the suggestions, with at least one record together. By default, all included tags are linked with an AND operator. This can be changed to OR by using isMatchAllIncludedTags(true).
Parameters
string[]Returns
SuggestTagConfigsuggestTagConfig
getFilterExcludedTags
getFilterExcludedTags():
string[]
Returns the global tags which must not be present in combination with the suggestions in a record.
Returns
string[]an array of global tags that must not be present in combination with the suggestions.
getFilterIncludedTags
getFilterIncludedTags():
string[]
Returns the global tags which must be included in combination with the suggestions, with at least one record together. By default, all included tags are linked with an AND operator. This can be changed to OR by using isMatchAllIncludedTags(true).
Returns
string[]an array of global tags that must be present in combination with the suggestions.
getLimit
getLimit():
number
Returns the maximum number of returned suggestions. Default is NULL, or no limit.
Returns
numberthe maximum number of returned suggestions.
getPattern
getPattern():
string
Returns the current search term for which suggestions should be returned.
Returns
stringcurrent search term.
isIncludeCounts
isIncludeCounts():
boolean
If true the overall count for each suggested tag will be included in the result. Default is false.
Returns
booleantrue if counts for each suggested tag should be returned.
isMatchAllIncludedTags
isMatchAllIncludedTags():
boolean
Specifies whether all included global tags for a proposal must be present in at least one record. Default is true. If set to false, at least one included tag must be present.
Returns
booleantrue if all included global tags must be present.
setFilterExcludedTags
setFilterExcludedTags(
pFilterExcludedTags):SuggestTagConfig
Sets the global tags which must not be present in combination with the suggestions in a record.
Parameters
string[]the excluded tags
Returns
SuggestTagConfigsuggestTagConfig
setFilterIncludedTags
setFilterIncludedTags(
pFilterIncludedTags):SuggestTagConfig
Sets the global tags which must be included in combination with the suggestions, with at least one record together. By default, all included tags are linked with an AND operator. This can be changed to OR by using isMatchAllIncludedTags(true).
Previous values are overridden.
Parameters
string[]Returns
SuggestTagConfigsuggestTagConfig
setIncludeCounts
setIncludeCounts(
pIncludeCounts):SuggestTagConfig
If true the overall count for each suggested tag will be included in the result. Default is false.
Parameters
booleantrue if counts for each suggested tag should be returned.
Returns
SuggestTagConfigsuggestTagConfig
setLimit
setLimit(
pLimit):SuggestTagConfig
Sets the maximum number of returned suggestions. Default is NULL, or no limit.
Parameters
numberReturns
SuggestTagConfigsuggestTagConfig
setMatchAllIncludedTags
setMatchAllIncludedTags(
pMatchAllIncludedTags):SuggestTagConfig
Specifies whether all included global tags for a proposal must be present in at least one record. Default is true. If set to false, at least one included tag must be present.
Parameters
booleantrue if all included global tags must be present.
Returns
SuggestTagConfigsuggestTagConfig
setPattern
setPattern(
pPattern):SuggestTagConfig
Sets the current search term for which suggestions should be returned.
Parameters
string | number | booleanReturns
SuggestTagConfigsuggestTagConfig
Example
<code>var stc = tag.createSuggestTagConfig()
.setPattern("adi")
.setLimit(3) // Sets max amount of returned suggestions. (Default is 10)
.setIncludeCounts(true); // Falg, which activates the determination of hashtag counts.
var res = tag.suggestHashtags(stc);
if( res.length > 0 )
{
var topTag = res[0].tag; // The suggested hashtag.
var weight = res[0].weight; // The relevance of the suggestion.
var count = res[0].count; // The usage of the tag. '-1' if disabled (default).
}
// Example of the returned array:
// [
// {
// "tag":"ADITO",
// "weight":10,
// "count":25
// },
// {
// "tag":"Neon ADITO",
// "weight":8,
// "count":7
// }
// ]
</code>