* Get all index configurations from the schema. * Useful for prebuilding all indexes.
()
| 612 | * Useful for prebuilding all indexes. |
| 613 | */ |
| 614 | public getAllIndexConfigs(): Array<{ |
| 615 | label: string; |
| 616 | property: string; |
| 617 | config: IndexConfig; |
| 618 | elementType: "vertex" | "edge"; |
| 619 | }> { |
| 620 | const configs: Array<{ |
| 621 | label: string; |
| 622 | property: string; |
| 623 | config: IndexConfig; |
| 624 | elementType: "vertex" | "edge"; |
| 625 | }> = []; |
| 626 | |
| 627 | // Vertex indexes |
| 628 | for (const [label, schema] of Object.entries(this.#schema.vertices)) { |
| 629 | for (const [property, propSchema] of Object.entries(schema.properties)) { |
| 630 | if (propSchema.index) { |
| 631 | configs.push({ |
| 632 | label, |
| 633 | property, |
| 634 | config: propSchema.index, |
| 635 | elementType: "vertex", |
| 636 | }); |
| 637 | } |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | // Edge indexes |
| 642 | for (const [label, schema] of Object.entries(this.#schema.edges)) { |
| 643 | for (const [property, propSchema] of Object.entries(schema.properties)) { |
| 644 | if (propSchema.index) { |
| 645 | configs.push({ |
| 646 | label, |
| 647 | property, |
| 648 | config: propSchema.index, |
| 649 | elementType: "edge", |
| 650 | }); |
| 651 | } |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | return configs; |
| 656 | } |
| 657 | } |