2016-11-03 04:03:20 +08:00
|
|
|
import {
|
|
|
|
Contact,
|
2016-11-10 23:35:16 +08:00
|
|
|
ModelSearchIndexer,
|
2016-11-03 04:03:20 +08:00
|
|
|
} from 'nylas-exports';
|
|
|
|
|
2016-11-10 23:35:16 +08:00
|
|
|
class ContactSearchIndexStore extends ModelSearchIndexer {
|
2016-11-03 04:03:20 +08:00
|
|
|
|
2016-11-10 23:35:16 +08:00
|
|
|
modelClass() { return Contact }
|
2016-11-03 04:03:20 +08:00
|
|
|
|
2016-11-10 23:35:16 +08:00
|
|
|
configKey() { return "contactSearchIndexVersion" }
|
2016-11-03 04:03:20 +08:00
|
|
|
|
2016-11-10 23:35:16 +08:00
|
|
|
INDEX_VERSION() { return 1 }
|
2016-11-03 04:03:20 +08:00
|
|
|
|
2016-11-10 23:35:16 +08:00
|
|
|
getIndexDataForModel(contact) {
|
2016-11-03 04:03:20 +08:00
|
|
|
return {
|
|
|
|
content: [
|
|
|
|
contact.name ? contact.name : '',
|
|
|
|
contact.email ? contact.email : '',
|
|
|
|
contact.email ? contact.email.replace('@', ' ') : '',
|
|
|
|
].join(' '),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new ContactSearchIndexStore()
|