Add resource length to elasticsearch index

This commit is contained in:
ibu 2022-01-02 14:44:44 +00:00
parent f8debcff87
commit 554cf14451

View file

@ -53,6 +53,7 @@ properties = {
'time_horizon': {'type': 'keyword'},
'orig_source': {'type': 'text'},
'topics': {'type': 'text'},
'length': {'type': 'integer'},
'annotations': {'type': 'text', 'index': False},
'sections': {
'type': 'nested',
@ -179,6 +180,7 @@ async def index_resource(
'time_horizon': resource.search_fields.get('time_horizon'),
'orig_source': resource.search_fields.get('orig_source'),
'topics': resource.search_fields.get('topics'),
'length': len(text),
'annotations': pack_annotations(annotations),
'sections': sections,
}