Search in sources :

Example 1 with GetTermsResult

use of io.zulia.client.result.GetTermsResult 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 GetTermsResult

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

the class GetTerms method execute.

@Override
public GetTermsResult execute(ZuliaConnection zuliaConnection) {
    ZuliaServiceBlockingStub service = zuliaConnection.getService();
    long start = System.currentTimeMillis();
    ZuliaServiceOuterClass.GetTermsResponse getTermsResponse = service.getTerms(getRequest());
    long end = System.currentTimeMillis();
    long durationInMs = end - start;
    return new GetTermsResult(getTermsResponse, durationInMs);
}
Also used : ZuliaServiceBlockingStub(io.zulia.message.ZuliaServiceGrpc.ZuliaServiceBlockingStub) ZuliaServiceOuterClass(io.zulia.message.ZuliaServiceOuterClass) GetTermsResult(io.zulia.client.result.GetTermsResult)

Aggregations

GetTermsResult (io.zulia.client.result.GetTermsResult)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 FetchResult (io.zulia.client.result.FetchResult)1 GetFieldsResult (io.zulia.client.result.GetFieldsResult)1 GetIndexConfigResult (io.zulia.client.result.GetIndexConfigResult)1 GetIndexesResult (io.zulia.client.result.GetIndexesResult)1 GetNodesResult (io.zulia.client.result.GetNodesResult)1 GetNumberOfDocsResult (io.zulia.client.result.GetNumberOfDocsResult)1 SearchResult (io.zulia.client.result.SearchResult)1 ZuliaServiceBlockingStub (io.zulia.message.ZuliaServiceGrpc.ZuliaServiceBlockingStub)1 ZuliaServiceOuterClass (io.zulia.message.ZuliaServiceOuterClass)1 Order (org.junit.jupiter.api.Order)1 Test (org.junit.jupiter.api.Test)1 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)1