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-13 02:32:16 +08:00
|
|
|
const INDEX_VERSION = 1;
|
2016-11-03 04:03:20 +08:00
|
|
|
|
2016-11-13 02:32:16 +08:00
|
|
|
class ContactSearchIndexer extends ModelSearchIndexer {
|
2016-11-03 04:03:20 +08:00
|
|
|
|
2016-11-13 02:32:16 +08:00
|
|
|
get ModelClass() {
|
|
|
|
return Contact;
|
|
|
|
}
|
|
|
|
|
|
|
|
get ConfigKey() {
|
|
|
|
return "contactSearchIndexVersion";
|
|
|
|
}
|
|
|
|
|
|
|
|
get IndexVersion() {
|
|
|
|
return INDEX_VERSION;
|
|
|
|
}
|
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(' '),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-13 02:32:16 +08:00
|
|
|
export default new ContactSearchIndexer()
|