Index
: shell
: query
: index
: /modules/core/search/services/index.js
: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/search/services/index.js
Index()
Builds indexes from content items and map functions.
index.getIndex() ⇒ object
Creates or gets an index.
Kind: instance method of Index
Returns: object - The index object.
| Param | Type | Description |
|---|---|---|
| [context.idFilter] | RegExp |
A regular expression that validates content item ids before they are read and indexed. |
| context.map | function |
The map function takes a content item and returns an array of index entries, a single index entry, or null. An index entry should have an id property. It is recommended to name the map function. |
| [context.orderBy] | function |
The function that defines the order on which the index entries should be sorted. It takes an index entry, and returns the sort order. The sort order can be a simple string, date, number, or it can be an array, in which case the items in the array will be used one after the other. It is recommended to name the order function. |
| [context.descending] | boolean |
Setting this to true reverses the order specified by the orderBy function. |
| [context.name] | string |
A name for the index. If not provided, one will be built from the other parameters. |