use of io.zulia.client.command.Fetch 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);
}
use of io.zulia.client.command.Fetch 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;
}
Aggregations