| 185 | } |
| 186 | |
| 187 | @Override |
| 188 | public void createIndex(final IndexType type, final Command cmd) throws IOException { |
| 189 | // close existing index |
| 190 | close(type); |
| 191 | final IndexBuilder ib = switch(type) { |
| 192 | case TEXT, ATTRIBUTE, TOKEN -> new DiskValuesBuilder(this, type); |
| 193 | case FULLTEXT -> new FTBuilder(this); |
| 194 | default -> throw Util.notExpected(); |
| 195 | }; |
| 196 | try { |
| 197 | if(cmd != null) cmd.pushJob(ib); |
| 198 | set(type, ib.build()); |
| 199 | } finally { |
| 200 | if(cmd != null) cmd.popJob(); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | @Override |
| 205 | public void dropIndex(final IndexType type) throws BaseXException { |