Search in sources :

Example 1 with FetchResult

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

the class Fetch method execute.

@Override
public FetchResult execute(ZuliaConnection zuliaConnection) {
    ZuliaServiceBlockingStub service = zuliaConnection.getService();
    FetchResponse fetchResponse = service.fetch(getRequest());
    return new FetchResult(fetchResponse);
}
Also used : ZuliaServiceBlockingStub(io.zulia.message.ZuliaServiceGrpc.ZuliaServiceBlockingStub) FetchResult(io.zulia.client.result.FetchResult) FetchResponse(io.zulia.message.ZuliaServiceOuterClass.FetchResponse)

Example 2 with FetchResult

use of io.zulia.client.result.FetchResult 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 3 with FetchResult

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

the class ZuliaCmdUtil method fileExists.

private static boolean fileExists(ZuliaWorkPool zuliaWorkPool, String id, String fileName, String indexName) throws Exception {
    Fetch fetchAssociated = new FetchAllAssociated(id, indexName).setAssociatedFetchType(META);
    FetchResult fetch = zuliaWorkPool.fetch(fetchAssociated);
    if (fetch.getAssociatedDocumentCount() > 0) {
        for (AssociatedResult assDoc : fetch.getAssociatedDocuments()) {
            if (assDoc.getFilename().equals(fileName)) {
                return true;
            }
        }
    }
    return false;
}
Also used : Fetch(io.zulia.client.command.Fetch) FetchResult(io.zulia.client.result.FetchResult) FetchAllAssociated(io.zulia.client.command.FetchAllAssociated) AssociatedResult(io.zulia.client.result.AssociatedResult)

Aggregations

FetchResult (io.zulia.client.result.FetchResult)3 Fetch (io.zulia.client.command.Fetch)2 FetchAllAssociated (io.zulia.client.command.FetchAllAssociated)1 GetTerms (io.zulia.client.command.GetTerms)1 ScoredQuery (io.zulia.client.command.builder.ScoredQuery)1 Search (io.zulia.client.command.builder.Search)1 AssociatedResult (io.zulia.client.result.AssociatedResult)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 GetTermsResult (io.zulia.client.result.GetTermsResult)1 SearchResult (io.zulia.client.result.SearchResult)1 ZuliaServiceBlockingStub (io.zulia.message.ZuliaServiceGrpc.ZuliaServiceBlockingStub)1 FetchResponse (io.zulia.message.ZuliaServiceOuterClass.FetchResponse)1 Order (org.junit.jupiter.api.Order)1 Test (org.junit.jupiter.api.Test)1 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)1