https://github.com/ecomplus/search-engine
Isomorphic JS lib to handle products search for E-Com Plus stores
https://github.com/ecomplus/search-engine
ecommerce-search ecomplus elasticsearch products-search search-algorithms search-api search-items
Last synced: about 1 month ago
JSON representation
Isomorphic JS lib to handle products search for E-Com Plus stores
- Host: GitHub
- URL: https://github.com/ecomplus/search-engine
- Owner: ecomplus
- License: mit
- Created: 2019-07-29T19:50:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-31T16:14:23.000Z (about 2 months ago)
- Last Synced: 2025-04-02T20:57:00.273Z (about 2 months ago)
- Topics: ecommerce-search, ecomplus, elasticsearch, products-search, search-algorithms, search-api, search-items
- Language: JavaScript
- Homepage: https://developers.e-com.plus/search-engine/
- Size: 2.76 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# E-Com Plus Search Engine
[](https://github.com/ecomplus/search-engine/actions?workflow=Publish) [](https://www.codefactor.io/repository/github/ecomplus/search-engine) [](https://www.npmjs.org/@ecomplus/search-engine) [](https://opensource.org/licenses/MIT)
UMD JS lib to handle products search for E-Com Plus stores
[CHANGELOG](https://github.com/ecomplus/search-engine/blob/master/CHANGELOG.md)
## Usage
The `@ecomplus/search-engine` package is a wrapper for [E-Com Plus Search API](https://developers.e-com.plus/docs/api/#/search/), can be used to handle a full featured products search system, from simple items search to applying multiple filters and aggregations.
It's available for both Node.js and browser environments.
- [Get started](https://developers.e-com.plus/search-engine/module-@ecomplus_search-engine.html)
- [Class reference](https://developers.e-com.plus/search-engine/EcomSearch.html)### Example
```js
import EcomSearch from '@ecomplus/search-engine'const search = new EcomSearch()
search.setSearchTerm('smartphone').fetch()
.then(result => {
search.getItems().forEach(item => {
console.log(item.name)
})
})
.catch(error => {
console.error(error)
if (error.response) {
console.log(error.response)
}
})
```#### Customize search query before fetch
```js
import EcomSearch from '@ecomplus/search-engine'EcomSearch.dslMiddlewares.push((dsl) => {
dsl.query.bool.filter.push({
terms: {
channel_id: [123]
}
})
})
```### Installation
It _may_ require and doesn't include `core-js` (optional) and [`@ecomplus/utils`](https://developers.e-com.plus/utils/) (peer dependency).
#### Webpack
```bash
npm i --save core-js @ecomplus/utils @ecomplus/search-engine
```#### Node.js
```bash
npm i --save @ecomplus/utils @ecomplus/search-engine
```#### CDN
```html
```
When importing from CDN, `_.cloneDeep`, `_.merge`, `ecomUtils` and `ecomClient` libraries **must be included separately** and available on window scope.