- Instead of
createSearchIndex(name, options)you now use the classEasySearch.Index(configuration) - Instead of
EasySearch.search(name, searchString, options[, callback])you now use the instance methodindex.search(searchDefinition, configuration) - Instead of
EasySearch.createSearcher(name, options)you create inherited classes, e.g. fromEasySearch.Engine(configuration) collection.initEasySearchhas been removed in favor of instantiating anEasySearch.Index- All options that were previously passed to
EasySearch.createSearchIndexare now split up into three levels of configuration: - Engine level configuration, how does the search behave (e.g. sort)
- Index level configuration, which data is searchable and general configuration (e.g. permission)
- Search level configuration, configuration specific to a search (e.g. limit)
let index = new EasySearch.Index({
// index level configuration
collection: myCollection,
engine: new EasySearch.Minimongo({
// engine level configuration
sort : () => ['score']
})
});
index.search('Marie', {
// search level configuration / options
limit: 20,
props: {
'maxScore': 200
}
});- ES6 / ES2015 is now used in the package code
- Packages have been split up into several packages
easysearch:core: contains the Javascript APIeasysearch:components: contains the Blaze Componentseasy:search: Wrapper package for components and coreeasysearch:elasticsearch: ElasticSearch engineeasysearch:autosuggest: Autosuggest componentmatteodem:easy-searchis now deprecated, switch toeasy:searchor one of the sub packages
- Since there are multiple layers of configuration options most of it has changed places or renamed / removed where it made sense
field=>fields: index configuratiion, always an array nowcollection=>collection: index configurationlimit=>limit: search configurationquery=>selectorandquery: engine configuration (mongo based engines useselectornow)sort=>sort: engine configurationuse=>engine: index configuration, is now an instanceof EngineconvertNumbers=> removed: logic should be configured itselfuseTextIndex=> removed: It's own engine now (EasySearch.MongoTextIndex)transform=>transform: engine configuration, Now always return a documentreturnFields=>beforePublish: engine configuration, A function to return fields that are publishedchangeResults=> removed: In favor ofbeforePublishortransformprops=>props: search configurationweights=>weights: engine configuration, only forEasySearch.MongoTextIndexpermission=>permission: index configuration- No
EasySearch.searchMultipleanymore, use the index instances themselves to search on multiple indexes - No
changeProperty,changeLimitanymore, use thepropsoption while using thesearchmethod - No
paginationanymore, use either the components package or implement the pagination logic by usingskipandlimitsearch configuration searchalways returns aEasySearch.Cursorthat can be used in a reactive context
- Components are now prefixed with
EasySearch(e.g.EasySearch.Input) EasySearch.getComponentInstanceis now split up into two index methodsindex.getComponentDict: Retrieve search values, (e.g. search string, limit)index.getComponentMethods: Use search component functionaly (e.g. searching, adding / removing props)
- Not part of core anymore, add
easysearch:elasticsearchto use bodyconfiguration to change ES body- ElasticSearch client reachable through
index.config.elasticSearchClient
- Not part of core anymore, add
easysearch:autossugestto use - Uses now
jeremy:selectizefor display logic
There are a lot of new features too, feel free to check them out.