Search in sources :

Example 1 with FieldConfigBuilder

use of io.zulia.fields.FieldConfigBuilder in project zuliasearch by zuliaio.

the class FileStorageTest method createIndex.

private void createIndex() throws Exception {
    ClientIndexConfig indexConfig = new ClientIndexConfig();
    indexConfig.setIndexName(TEST_INDEX);
    indexConfig.setNumberOfShards(1);
    indexConfig.setShardCommitInterval(64000);
    indexConfig.addAnalyzerSetting(ZuliaIndex.AnalyzerSettings.newBuilder().setName("text").addFilter(ZuliaIndex.AnalyzerSettings.Filter.CASE_PROTECTED_WORDS).addFilter(ZuliaIndex.AnalyzerSettings.Filter.LOWERCASE).addFilter(ZuliaIndex.AnalyzerSettings.Filter.ASCII_FOLDING).addFilter(ZuliaIndex.AnalyzerSettings.Filter.ENGLISH_POSSESSIVE).addFilter(ZuliaIndex.AnalyzerSettings.Filter.ENGLISH_MIN_STEM).addFilter(ZuliaIndex.AnalyzerSettings.Filter.BRITISH_US).build());
    indexConfig.addAnalyzerSetting(ZuliaIndex.AnalyzerSettings.newBuilder().setName("entity").addFilter(ZuliaIndex.AnalyzerSettings.Filter.LOWERCASE).addFilter(ZuliaIndex.AnalyzerSettings.Filter.ASCII_FOLDING).build());
    FieldConfigBuilder fieldConfigBuilder = FieldConfigBuilder.create("title", ZuliaIndex.FieldConfig.FieldType.STRING);
    fieldConfigBuilder.indexAs("text", "title");
    fieldConfigBuilder.displayName("Title");
    indexConfig.addFieldConfig(fieldConfigBuilder);
    FieldConfigBuilder fieldConfigBuilder2 = FieldConfigBuilder.create("abstract", ZuliaIndex.FieldConfig.FieldType.STRING);
    fieldConfigBuilder2.indexAs("text", "abstract");
    fieldConfigBuilder2.displayName("Abstract");
    indexConfig.addFieldConfig(fieldConfigBuilder2);
    FieldConfigBuilder fieldConfigBuilder3 = FieldConfigBuilder.create("id", ZuliaIndex.FieldConfig.FieldType.STRING);
    fieldConfigBuilder3.indexAs(DefaultAnalyzers.STANDARD, "id");
    fieldConfigBuilder3.displayName("ID");
    indexConfig.addFieldConfig(fieldConfigBuilder3);
    CreateIndex createOrUpdateIndex = new CreateIndex(indexConfig);
    zuliaWorkPool.createIndex(createOrUpdateIndex);
}
Also used : CreateIndex(io.zulia.client.command.CreateIndex) ClientIndexConfig(io.zulia.client.config.ClientIndexConfig) FieldConfigBuilder(io.zulia.fields.FieldConfigBuilder)

Aggregations

CreateIndex (io.zulia.client.command.CreateIndex)1 ClientIndexConfig (io.zulia.client.config.ClientIndexConfig)1 FieldConfigBuilder (io.zulia.fields.FieldConfigBuilder)1