We use suggest for the auto-completion input fields in isearch-ui and taggy-ui.
var taggy = require('taggable-searcher');
taggy.suggest({
text: 'Spa',
context: 'dk:da',
include: 'hotel',
exclude: 'geo',
start: 0,
size: 10
}, callback)
Type: string
This is the text that is used to suggest auto-completion possibilities.
This is a mandatory field.
Type: string
Default: taggy
This is a unique identifier to differentiate different markets and languages.
E.g. a Danish context may look like this: dk:da
Type: array
or string
Default: empty
You can provide an include parameter to only suggest options that have the tagid prefix provided.
E.g. When I search for Spa I only want suggestions related to a geo-location. Then I will have to add geo
to the include parameter.
Note: Use include or exclude, but not both.
Type: array
or string
Default: empty
This is the opposite of include.
E.g. When I search for Spa I want suggestions that are not related to a geo-location. Then I will have to add geo
to the exclude parameter.
Note: Use include or exclude, but not both.
Type: int
Default: 0
Specifies the offset of the first search hit you want to return. Note that the result set is zero-based; the first result is at index 0. You can specify either the start or cursor parameter in a request, they are mutually exclusive.
Type: int
default: 10
Specifies the maximum number of search hits to include in the response.
{
"status": {
"timems": 0,
"rid": "8uWhicgq4FwKUJQt"
},
"hits": {
"found": 1,
"start": 0,
"hit": [{
"id": "taggy:geo:geonames.2510769",
"fields": {
"name": ["Spain"],
"tagid": ["geo:geonames.2510769"],
"label": ["Spain"],
"context": ["taggy"],
"active": ["true"],
"boost": ["1"]
}
}]
}
}
In order for this to work we need to set up 1 environment variable or initialize it manually before we use any function.
CLOUDSEARCH_ENDPOINT The cloudsearch endpoint
taggy.suggest.init('cloud search endpoint');