Search Engine
buildfire.searchEngine
#
This is a built-in APIs that allows your control or widget to access highly scalable full-text search service. It allows you to store, search big volumes of data quickly and in near real-time.
#
Requirements#
WidgetInclude searchEngine.js
file in widget header right after the buildfire.min.js
#
ControlInclude searchEngine.js
file in control header right after the buildfire.min.js
#
Methodsinsert()
#
buildfire.services.searchEngine.insert(options, callback)
Inserts a new item into search engine
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
linkedUser | boolean | no | This will make the data linked to the current logged user, which means it will be private. | |
tag | string | yes | A unique key for your data, this is important for categorizing your data. | |
title | string | yes | Title for your data, this will be searchable by our search engine. | |
description | string | no | Description for your data, this will be searchable by our search engine. | |
keywords | string | no | Any keywords related to your data, this will be searchable by our search engine. | |
imageUrl | string | no | Image url on search results | |
data | object | no | You can add whatever you want here, this won't be searchable by our search engine. |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | object | Object containing id property, which is the id of the newly saved data. |
save()
#
buildfire.services.searchEngine.save(options, callback)
Saves a new item into search engine
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
linkedUser | boolean | no | This will make the data linked to the current logged user, which means it will be private. | |
tag | string | yes | A unique key for your data, this is important for categorizing your data. | |
key | string | yes | A unique key for your document, this is the id for your document. | |
title | string | yes | Title for your data, this will be searchable by our search engine. | |
description | string | no | Description for your data, this will be searchable by our search engine. | |
keywords | string | no | Any keywords related to your data, this will be searchable by our search engine. | |
imageUrl | string | no | Image url on search results | |
data | object | no | You can add whatever you want here, this won't be searchable by our search engine. |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | object | Object containing id property, which is the id of the newly saved data. |
update()
#
buildfire.services.searchEngine.update(options, callback)
Inserts a new item into search engine
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
id | string | yes | An id for your document to update it. | |
linkedUser | boolean | no | This will make the data linked to the current logged user, which means it will be private. | |
tag | string | yes | A unique key for your data, this is important for categorizing your data. | |
title | string | yes | Title for your data, this will be searchable by our search engine. | |
description | string | no | Description for your data, this will be searchable by our search engine. | |
keywords | string | no | Any keywords related to your data, this will be searchable by our search engine. | |
imageUrl | string | no | Image url on search results | |
data | object | no | You can add whatever you want here, this won't be searchable by our search engine. |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | object | Object containing id property, which is the id of the newly saved data. |
delete()
#
buildfire.services.searchEngine.delete(options, callback)
Inserts a new item into search engine
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
id | string | yes | An id for your document to update it. | |
tag | string | yes | A unique key for your data, this is important for categorizing your data. |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | boolean | Indicates if data has been deleted |
search()
#
buildfire.services.searchEngine.search(options, callback)
Searches the search engine items.
Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance.
An edit distance is the number of one-character changes needed to turn one term into another. These changes can include:
- Changing a character (box โ fox)
- Removing a character (black โ lack)
- Inserting a character (sic โ sick)
- Transposing two adjacent characters (act โ cat)
To find similar terms, the fuzzy query creates a set of all possible variations, or expansions, of the search term within a specified edit distance. The query then returns exact matches for each expansion.
The number of edits which allowed in our search APIs is (2).
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
searchText | string | yes | Your search text. | |
linkedUser | string | yes | If true this will return all public data and the data added by the current logged user. | |
pageIndex | string | no | Index of returned page. | 0 |
pageSize | string | no | Number of results returned per page. | 50 |
preHighlightTag | string | no | Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. | |
postHighlightTag | string | no | Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | boolean | Search results |
feeds.insert()
#
buildfire.services.searchEngine.feeds.insert(options, callback)
Inserts a new rss feed into search engine
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
tag | string | yes | A unique key for your data, this is important for categorizing your data. | |
title | string | yes | Title for your feed. | |
description | string | yes | Description for your feed. | |
feedType | string | yes | Feed type. Available types: "rss" | |
feedConfig | object | yes | Feed config. | |
feedItemConfig | object | yes | Feed item config. |
options.feedConfig
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
url | string | yes | Feed url |
options.feedItemConfig
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
uniqueKey | string | no | Unique key for each item returned from rss service. | "guid" |
titleKey | string | no | The title for each item returned from rss service. | "title" |
descriptionKey | string | no | The description key for each item returned from rss service. | "description" |
urlKey | string | no | The url key for each item returned from rss service. | "link" |
publishDateKey | string | no | The publish date key for each item returned from rss service. | "pubDate" |
imageUrlKey | string | no | The image url key for each item returned from rss service. | "thumbnail" |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | boolean | Indicates if rss feed has been attached |
feeds.get()
#
buildfire.services.searchEngine.feeds.get(options, callback)
Fetches rss feeds from search engine
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
tag | string | yes | A unique key for your data, this is important for categorizing your data. | |
feedType | string | yes | Feed type. Available types: "rss" |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | boolean | All the attached feeds related to the specified tag & feedType . |
feeds.delete()
#
buildfire.services.searchEngine.feeds.delete(options, callback)
Deletes rss feed from search engine
options
#
Name | Type | Required | Description | Default |
---|---|---|---|---|
tag | string | yes | A unique key for your data, this is important for categorizing your data. | |
feedId | string | yes | Feed id that will be returned from feeds.get method. | |
removeFeedData | boolean | no | If true, this will remove all feed data inside the app that's related to this feed. |
callback(err, result)
#
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
result | boolean | Indicates if feed has been detached |