Search in sources :

Example 1 with GetIndexConfigResult

use of io.zulia.client.result.GetIndexConfigResult in project zuliasearch by zuliaio.

the class AliasTest method aliasSearchTest.

@Test
@Order(3)
public void aliasSearchTest() throws Exception {
    Search search = new Search(ALIAS_TEST_INDEX);
    SearchResult searchResult = zuliaWorkPool.search(search);
    Assertions.assertEquals(repeatCount * 2 * uniqueDocs, searchResult.getTotalHits());
    search = new Search("someAlias");
    searchResult = zuliaWorkPool.search(search);
    Assertions.assertEquals(repeatCount * 2 * uniqueDocs, searchResult.getTotalHits());
    search = new Search(ALIAS_TEST_INDEX);
    search.addQuery(new ScoredQuery("rating:[4.0 TO *]"));
    searchResult = zuliaWorkPool.search(search);
    Assertions.assertEquals(repeatCount * 2 * 3, searchResult.getTotalHits());
    search = new Search("someAlias");
    search.addQuery(new ScoredQuery("rating:[4.0 TO *]"));
    searchResult = zuliaWorkPool.search(search);
    Assertions.assertEquals(repeatCount * 2 * 3, searchResult.getTotalHits());
    GetNumberOfDocsResult numberOfDocs = zuliaWorkPool.getNumberOfDocs("someAlias");
    Assertions.assertEquals(repeatCount * 2 * uniqueDocs, numberOfDocs.getNumberOfDocs());
    GetFieldsResult getFields = zuliaWorkPool.getFields("someAlias");
    Assertions.assertEquals(3, getFields.getFieldNames().size());
    GetTermsResult getTermsResult = zuliaWorkPool.execute(new GetTerms("someAlias", "title"));
    Assertions.assertEquals(6, getTermsResult.getTerms().size());
    GetIndexesResult indexes = zuliaWorkPool.getIndexes();
    Assertions.assertEquals(1, indexes.getIndexNames().size());
    GetNodesResult nodes = zuliaWorkPool.getNodes();
    Assertions.assertEquals(1, nodes.getIndexAliases().size());
    FetchResult fetch = zuliaWorkPool.fetch(new Fetch("1", "someAlias"));
    Assertions.assertEquals("1", fetch.getDocument().getString("id"));
    GetIndexConfigResult indexConfig = zuliaWorkPool.getIndexConfig("someAlias");
    Assertions.assertEquals(indexConfig.getIndexConfig().getIndexName(), ALIAS_TEST_INDEX);
}
Also used : Fetch(io.zulia.client.command.Fetch) ScoredQuery(io.zulia.client.command.builder.ScoredQuery) GetNodesResult(io.zulia.client.result.GetNodesResult) FetchResult(io.zulia.client.result.FetchResult) GetIndexConfigResult(io.zulia.client.result.GetIndexConfigResult) Search(io.zulia.client.command.builder.Search) GetIndexesResult(io.zulia.client.result.GetIndexesResult) GetNumberOfDocsResult(io.zulia.client.result.GetNumberOfDocsResult) SearchResult(io.zulia.client.result.SearchResult) GetFieldsResult(io.zulia.client.result.GetFieldsResult) GetTerms(io.zulia.client.command.GetTerms) GetTermsResult(io.zulia.client.result.GetTermsResult) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Test(org.junit.jupiter.api.Test)

Example 2 with GetIndexConfigResult

use of io.zulia.client.result.GetIndexConfigResult in project zuliasearch by zuliaio.

the class GetIndexConfig method execute.

@Override
public GetIndexConfigResult execute(ZuliaConnection zuliaConnection) {
    ZuliaServiceBlockingStub service = zuliaConnection.getService();
    GetIndexSettingsResponse getIndexConfigResponse = service.getIndexSettings(getRequest());
    ClientIndexConfig indexConfig = new ClientIndexConfig();
    indexConfig.configure(getIndexConfigResponse.getIndexSettings());
    return new GetIndexConfigResult(indexConfig);
}
Also used : ZuliaServiceBlockingStub(io.zulia.message.ZuliaServiceGrpc.ZuliaServiceBlockingStub) GetIndexSettingsResponse(io.zulia.message.ZuliaServiceOuterClass.GetIndexSettingsResponse) GetIndexConfigResult(io.zulia.client.result.GetIndexConfigResult) ClientIndexConfig(io.zulia.client.config.ClientIndexConfig)

Aggregations

GetIndexConfigResult (io.zulia.client.result.GetIndexConfigResult)2 Fetch (io.zulia.client.command.Fetch)1 GetTerms (io.zulia.client.command.GetTerms)1 ScoredQuery (io.zulia.client.command.builder.ScoredQuery)1 Search (io.zulia.client.command.builder.Search)1 ClientIndexConfig (io.zulia.client.config.ClientIndexConfig)1 FetchResult (io.zulia.client.result.FetchResult)1 GetFieldsResult (io.zulia.client.result.GetFieldsResult)1 GetIndexesResult (io.zulia.client.result.GetIndexesResult)1 GetNodesResult (io.zulia.client.result.GetNodesResult)1 GetNumberOfDocsResult (io.zulia.client.result.GetNumberOfDocsResult)1 GetTermsResult (io.zulia.client.result.GetTermsResult)1 SearchResult (io.zulia.client.result.SearchResult)1 ZuliaServiceBlockingStub (io.zulia.message.ZuliaServiceGrpc.ZuliaServiceBlockingStub)1 GetIndexSettingsResponse (io.zulia.message.ZuliaServiceOuterClass.GetIndexSettingsResponse)1 Order (org.junit.jupiter.api.Order)1 Test (org.junit.jupiter.api.Test)1 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)1