Skip to main content
Skip to main content

SearchService

internal.internal.SearchService

Properties

isDefaultbooleanRequired
logger_LoggerRequired
options_Record<string, unknown>Required

Accessors

options

get options(): Record<string, unknown>

Returns

Record<string, unknown>

RecordRecord<string, unknown>Required

Inherited from

AbstractSearchService.options

Methods

addDocuments

addDocuments(indexName, documents, type): Promise<void>

Used to index documents by the search engine provider

Parameters

indexNamestringRequired
the index name
documentsunknownRequired
documents array to be indexed
typestringRequired
of documents to be added (e.g: products, regions, orders, etc)

Returns

Promise<void>

PromisePromise<void>Required
returns response from search engine provider

Overrides

AbstractSearchService.addDocuments


createIndex

createIndex(indexName, options): Promise<void>

Used to create an index

Parameters

indexNamestringRequired
the index name
optionsunknownRequired
the options

Returns

Promise<void>

PromisePromise<void>Required
returns response from search engine provider

Overrides

AbstractSearchService.createIndex


deleteAllDocuments

deleteAllDocuments(indexName): Promise<void>

Used to delete all documents

Parameters

indexNamestringRequired
the index name

Returns

Promise<void>

PromisePromise<void>Required
returns response from search engine provider

Overrides

AbstractSearchService.deleteAllDocuments


deleteDocument

deleteDocument(indexName, document_id): Promise<void>

Used to delete document

Parameters

indexNamestringRequired
the index name
document_idstring | numberRequired
the id of the document

Returns

Promise<void>

PromisePromise<void>Required
returns response from search engine provider

Overrides

AbstractSearchService.deleteDocument


getIndex

getIndex(indexName): Promise<void>

Used to get an index

Parameters

indexNamestringRequired
the index name.

Returns

Promise<void>

PromisePromise<void>Required
returns response from search engine provider

Overrides

AbstractSearchService.getIndex


replaceDocuments

replaceDocuments(indexName, documents, type): Promise<void>

Used to replace documents

Parameters

indexNamestringRequired
the index name.
documentsunknownRequired
array of document objects that will replace existing documents
typestringRequired
type of documents to be replaced (e.g: products, regions, orders, etc)

Returns

Promise<void>

PromisePromise<void>Required
returns response from search engine provider

Overrides

AbstractSearchService.replaceDocuments


search(indexName, query, options): Promise<{ hits: unknown[] }>

Used to search for a document in an index

Parameters

indexNamestringRequired
the index name
queryunknownRequired
the search query
optionsunknownRequired
any options passed to the request object other than the query and indexName - additionalOptions contain any provider specific options

Returns

Promise<{ hits: unknown[] }>

PromisePromise<{ hits: unknown[] }>Required
returns response from search engine provider

Overrides

AbstractSearchService.search


updateSettings

updateSettings(indexName, settings): Promise<void>

Used to update the settings of an index

Parameters

indexNamestringRequired
the index name
settingsunknownRequired
settings object

Returns

Promise<void>

PromisePromise<void>Required
returns response from search engine provider

Overrides

AbstractSearchService.updateSettings

Was this section helpful?