| 15 | const void *key, size_t key_len, uint *doc_field_count); |
| 16 | |
| 17 | void Index_IndexNode |
| 18 | ( |
| 19 | Index idx, |
| 20 | const Node *n |
| 21 | ) { |
| 22 | ASSERT(n != NULL); |
| 23 | ASSERT(idx != NULL); |
| 24 | |
| 25 | EntityID key = ENTITY_GET_ID(n); |
| 26 | RSDoc *doc = NULL; |
| 27 | RSIndex *rsIdx = Index_RSIndex(idx); |
| 28 | size_t key_len = sizeof(EntityID); |
| 29 | uint doc_field_count = 0; |
| 30 | |
| 31 | // create RediSearch document representing node |
| 32 | doc = Index_IndexGraphEntity(idx, (const GraphEntity *)n, |
| 33 | (const void *)&key, key_len, &doc_field_count); |
| 34 | |
| 35 | if(doc_field_count == 0) { |
| 36 | // entity doesn't poses any attributes which are indexed |
| 37 | // remove entity from index and delete document |
| 38 | Index_RemoveNode(idx, n); |
| 39 | RediSearch_FreeDocument(doc); |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | // add document to RediSearch index |
| 44 | RediSearch_SpecAddDocument(rsIdx, doc); |
| 45 | } |
| 46 | |
| 47 | void Index_RemoveNode |
| 48 | ( |
no test coverage detected