This repo attempts to create a type-independent API for indexing chunks for searching.
const createChunk = require('./lib/createChunk');
const message = createChunk({
"type": "message",
"content": {
"user": "Monty",
"text": "Hello",
"url": "http://telegram.com/"
},
"date": 1544551774794,
"source": "telegram"
});
message.toTerms();
// [ 'Monty', 'Hello' ]
const text = createChunk({
"type": "text",
"content": "Hello, World",
"date": 1544551774794,
"source": "telegram"
});
text.toTerms();
// [ 'Hello, World' ]
A chunk is a time-discrete event in a stream.
{
"type": String,
"content": Object,
"date": Number,
"source": String
}
{
"type": "text",
"content": "Hello, World",
"date": 1544551774794,
"source": "telegram"
}
{
"type": "message",
"content": {
"user": "Monty",
"text": "Hello",
"url": "http://telegram.com/"
},
"date": 1544551774794,
"source": "telegram"
}