free index
| 585 | |
| 586 | // free index |
| 587 | void Index_Free |
| 588 | ( |
| 589 | Index idx |
| 590 | ) { |
| 591 | ASSERT(idx != NULL); |
| 592 | |
| 593 | if(idx->rsIdx) { |
| 594 | RediSearch_DropIndex(idx->rsIdx); |
| 595 | } |
| 596 | |
| 597 | if(idx->language) { |
| 598 | rm_free(idx->language); |
| 599 | } |
| 600 | |
| 601 | uint fields_count = array_len(idx->fields); |
| 602 | for(uint i = 0; i < fields_count; i++) { |
| 603 | IndexField_Free(idx->fields + i); |
| 604 | } |
| 605 | array_free(idx->fields); |
| 606 | |
| 607 | if(idx->stopwords) { |
| 608 | uint stopwords_count = array_len(idx->stopwords); |
| 609 | for(uint i = 0; i < stopwords_count; i++) { |
| 610 | rm_free(idx->stopwords[i]); |
| 611 | } |
| 612 | array_free(idx->stopwords); |
| 613 | } |
| 614 | |
| 615 | rm_free(idx->label); |
| 616 | rm_free(idx); |
| 617 | } |
| 618 |
no test coverage detected