Mailspring/packages/nylas-mail/internal_packages/search-index/lib/event-search-indexer.es6
2017-02-16 13:15:10 -08:00

37 lines
662 B
JavaScript

import {Event, ModelSearchIndexer} from 'nylas-exports'
const INDEX_VERSION = 1
class EventSearchIndexer extends ModelSearchIndexer {
get MaxIndexSize() {
return 5000;
}
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()