create a new index
| 278 | |
| 279 | // create a new index |
| 280 | Index Index_New |
| 281 | ( |
| 282 | const char *label, // indexed label |
| 283 | int label_id, // indexed label id |
| 284 | IndexType type, // exact match or full text |
| 285 | GraphEntityType entity_type // entity type been indexed |
| 286 | ) { |
| 287 | ASSERT(label != NULL); |
| 288 | |
| 289 | Index idx = rm_malloc(sizeof(_Index)); |
| 290 | |
| 291 | idx->type = type; |
| 292 | idx->label = rm_strdup(label); |
| 293 | idx->rsIdx = NULL; |
| 294 | idx->fields = array_new(IndexField, 1); |
| 295 | idx->label_id = label_id; |
| 296 | idx->language = NULL; |
| 297 | idx->stopwords = NULL; |
| 298 | idx->entity_type = entity_type; |
| 299 | idx->pending_changes = ATOMIC_VAR_INIT(0); |
| 300 | |
| 301 | return idx; |
| 302 | } |
| 303 | |
| 304 | // clone index |
| 305 | Index Index_Clone |
no test coverage detected