2016-11-13 02:32:16 +08:00
|
|
|
import {Event, ModelSearchIndexer} from 'nylas-exports'
|
|
|
|
|
|
|
|
|
|
|
|
const INDEX_VERSION = 1
|
|
|
|
|
|
|
|
class EventSearchIndexer extends ModelSearchIndexer {
|
|
|
|
|
2017-01-20 03:43:43 +08:00
|
|
|
get MaxIndexSize() {
|
|
|
|
return 5000;
|
|
|
|
}
|
|
|
|
|
2016-11-13 02:32:16 +08:00
|
|
|
get ConfigKey() {
|
|
|
|
return 'eventSearchIndexVersion';
|
|
|
|
}
|
|
|
|
|
|
|
|
get IndexVersion() {
|
|
|
|
return INDEX_VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
get ModelClass() {
|
|
|
|
return Event;
|
|
|
|
}
|
|
|
|
|
|
|
|
getIndexDataForModel(event) {
|
|
|
|
const {title, description, location, participants} = event
|
|
|
|
return {
|
|
|
|
title,
|
|
|
|
location,
|
|
|
|
description,
|
|
|
|
participants: participants
|
|
|
|
.map((c) => `${c.name || ''} ${c.email || ''}`)
|
|
|
|
.join(' '),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new EventSearchIndexer()
|