Search in sources :

Example 1 with ClientIndexConfig

use of io.zulia.client.config.ClientIndexConfig in project zuliasearch by zuliaio.

the class StartStopTest method initAll.

@BeforeAll
public static void initAll() throws Exception {
    TestHelper.createNodes(3);
    TestHelper.startNodes();
    Thread.sleep(2000);
    zuliaWorkPool = TestHelper.createClient();
    ClientIndexConfig indexConfig = new ClientIndexConfig();
    indexConfig.addDefaultSearchField("title");
    indexConfig.addFieldConfig(FieldConfigBuilder.create("id", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("title", FieldType.STRING).indexAs(DefaultAnalyzers.STANDARD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("issn", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facet().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("eissn", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD));
    indexConfig.addFieldConfig(FieldConfigBuilder.create("uid", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD));
    indexConfig.addFieldConfig(FieldConfigBuilder.create("an", FieldType.NUMERIC_INT).index().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("country", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facet());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("date", FieldType.DATE).index().facetAs(DateHandling.DATE_YYYY_MM_DD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("testList", FieldType.STRING).index());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("testBool", FieldType.BOOL).index().facet().sort());
    indexConfig.setIndexName(FACET_TEST_INDEX);
    indexConfig.setNumberOfShards(1);
    // force some commits
    indexConfig.setShardCommitInterval(20);
    zuliaWorkPool.createIndex(indexConfig);
}
Also used : ClientIndexConfig(io.zulia.client.config.ClientIndexConfig) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with ClientIndexConfig

use of io.zulia.client.config.ClientIndexConfig in project zuliasearch by zuliaio.

the class StatTest method reindex.

@Test
@Order(4)
public void reindex() throws Exception {
    ClientIndexConfig indexConfig = new ClientIndexConfig();
    indexConfig.addDefaultSearchField("title");
    indexConfig.addFieldConfig(FieldConfigBuilder.create("id", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("title", FieldType.STRING).indexAs(DefaultAnalyzers.STANDARD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("pathFacet", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facetHierarchical().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("normalFacet", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facet().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("authorCount", FieldType.NUMERIC_INT).index().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("rating", FieldType.NUMERIC_DOUBLE).index().sort());
    indexConfig.setIndexName(STAT_TEST_INDEX);
    indexConfig.setNumberOfShards(1);
    // force some commits
    indexConfig.setShardCommitInterval(20);
    zuliaWorkPool.createIndex(indexConfig);
    // trigger indexing again with path2 added in the index config
    index();
}
Also used : ClientIndexConfig(io.zulia.client.config.ClientIndexConfig) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 3 with ClientIndexConfig

use of io.zulia.client.config.ClientIndexConfig in project zuliasearch by zuliaio.

the class StatTest method initAll.

@BeforeAll
public static void initAll() throws Exception {
    TestHelper.createNodes(3);
    TestHelper.startNodes();
    Thread.sleep(2000);
    zuliaWorkPool = TestHelper.createClient();
    ClientIndexConfig indexConfig = new ClientIndexConfig();
    indexConfig.addDefaultSearchField("title");
    indexConfig.addFieldConfig(FieldConfigBuilder.create("id", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("title", FieldType.STRING).indexAs(DefaultAnalyzers.STANDARD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("pathFacet", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facetHierarchical().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("normalFacet", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facet().sort());
    // indexConfig.addFieldConfig(FieldConfigBuilder.create("authorCount", FieldType.NUMERIC_INT).index().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("rating", FieldType.NUMERIC_DOUBLE).index().sort());
    indexConfig.setIndexName(STAT_TEST_INDEX);
    indexConfig.setNumberOfShards(1);
    // force some commits
    indexConfig.setShardCommitInterval(20);
    zuliaWorkPool.createIndex(indexConfig);
}
Also used : ClientIndexConfig(io.zulia.client.config.ClientIndexConfig) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with ClientIndexConfig

use of io.zulia.client.config.ClientIndexConfig in project zuliasearch by zuliaio.

the class AliasTest method initAll.

@BeforeAll
public static void initAll() throws Exception {
    TestHelper.createNodes(3);
    TestHelper.startNodes();
    Thread.sleep(2000);
    zuliaWorkPool = TestHelper.createClient();
    ClientIndexConfig indexConfig = new ClientIndexConfig();
    indexConfig.addDefaultSearchField("title");
    indexConfig.addFieldConfig(FieldConfigBuilder.create("id", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("title", FieldType.STRING).indexAs(DefaultAnalyzers.STANDARD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("rating", FieldType.NUMERIC_DOUBLE).index().sort());
    indexConfig.setIndexName(ALIAS_TEST_INDEX);
    indexConfig.setNumberOfShards(1);
    // force some commits
    indexConfig.setShardCommitInterval(20);
    zuliaWorkPool.createIndex(indexConfig);
}
Also used : ClientIndexConfig(io.zulia.client.config.ClientIndexConfig) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with ClientIndexConfig

use of io.zulia.client.config.ClientIndexConfig in project zuliasearch by zuliaio.

the class HierarchicalFacetTest method reindex.

@Test
@Order(4)
public void reindex() throws Exception {
    ClientIndexConfig indexConfig = new ClientIndexConfig();
    indexConfig.addDefaultSearchField("title");
    indexConfig.addFieldConfig(FieldConfigBuilder.create("id", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("title", FieldType.STRING).indexAs(DefaultAnalyzers.STANDARD).sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("path", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facetHierarchical().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("path2", FieldType.STRING).indexAs(DefaultAnalyzers.LC_KEYWORD).facetHierarchical().sort());
    indexConfig.addFieldConfig(FieldConfigBuilder.create("date", FieldType.DATE).index().facetHierarchical().sort());
    indexConfig.setIndexName(FACET_TEST_INDEX);
    indexConfig.setNumberOfShards(1);
    // force some commits
    indexConfig.setShardCommitInterval(20);
    zuliaWorkPool.createIndex(indexConfig);
    // trigger indexing again with path2 added in the index config
    index();
}
Also used : ClientIndexConfig(io.zulia.client.config.ClientIndexConfig) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Test(org.junit.jupiter.api.Test)

Aggregations

ClientIndexConfig (io.zulia.client.config.ClientIndexConfig)14 Order (org.junit.jupiter.api.Order)6 Test (org.junit.jupiter.api.Test)6 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)6 BeforeAll (org.junit.jupiter.api.BeforeAll)4 Search (io.zulia.client.command.builder.Search)3 SearchResult (io.zulia.client.result.SearchResult)3 CreateIndex (io.zulia.client.command.CreateIndex)2 Reindex (io.zulia.client.command.Reindex)2 Store (io.zulia.client.command.Store)2 Sort (io.zulia.client.command.builder.Sort)2 Document (org.bson.Document)2 CountFacet (io.zulia.client.command.builder.CountFacet)1 GetIndexConfigResult (io.zulia.client.result.GetIndexConfigResult)1 FieldConfigBuilder (io.zulia.fields.FieldConfigBuilder)1 FieldConfig (io.zulia.message.ZuliaIndex.FieldConfig)1 FacetCount (io.zulia.message.ZuliaQuery.FacetCount)1 ZuliaServiceBlockingStub (io.zulia.message.ZuliaServiceGrpc.ZuliaServiceBlockingStub)1 GetIndexSettingsResponse (io.zulia.message.ZuliaServiceOuterClass.GetIndexSettingsResponse)1 LocalDate (java.time.LocalDate)1