use of io.zulia.message.ZuliaQuery.FetchType in project zuliasearch by zuliaio.
the class ZuliaIndex method fetch.
public ZuliaServiceOuterClass.FetchResponse fetch(ZuliaServiceOuterClass.FetchRequest fetchRequest) throws Exception {
ZuliaServiceOuterClass.FetchResponse.Builder frBuilder = ZuliaServiceOuterClass.FetchResponse.newBuilder();
String uniqueId = fetchRequest.getUniqueId();
FetchType resultFetchType = fetchRequest.getResultFetchType();
if (!FetchType.NONE.equals(resultFetchType)) {
ZuliaBase.ResultDocument resultDoc = getSourceDocument(uniqueId, resultFetchType, fetchRequest.getDocumentFieldsList(), fetchRequest.getDocumentMaskedFieldsList());
if (null != resultDoc) {
frBuilder.setResultDocument(resultDoc);
}
}
FetchType associatedFetchType = fetchRequest.getAssociatedFetchType();
if (!FetchType.NONE.equals(associatedFetchType)) {
if (!fetchRequest.getFilename().isEmpty()) {
AssociatedDocument ad = getAssociatedDocument(uniqueId, fetchRequest.getFilename(), associatedFetchType);
if (ad != null) {
frBuilder.addAssociatedDocument(ad);
}
} else {
for (AssociatedDocument ad : getAssociatedDocuments(uniqueId, associatedFetchType)) {
frBuilder.addAssociatedDocument(ad);
}
}
}
return frBuilder.build();
}
Aggregations