Search JS is a wrapper for the Nosto Search functionality with some extended functionality such as
- Nosto currency formatting
- Nosto product thumbnails
- Retry logic
For @nosto/search-js specific API documentation, see Our Typedoc.
For more information about Nosto platform, see Our documentation.
For sources, issues and contributions, see the GitHub repository.
To install the package, use your preferred package manager:
yarn add @nosto/search-js
# or
npm install @nosto/search-js --save
When using this library, it is not necessary to create the Nosto stub. It will be created automatically as soon as the library is imported for the first time.
The main export of this library is the search
function. It is compatible with the search function of the Nosto JS API and adds a couple of additional options
import { search } from "@nosto/search-js"
import { priceDecorator } from "@nosto/search-js/currencies"
const response = await search({
query: 'my search',
products: {
fields: [
"productId",
"name",
"price",
"listPrice",
"priceCurrencyCode"
]
}
}, {
track: 'serp',
hitDecorators: [
priceDecorator()
]
})