use of com.yelp.nrtsearch.server.grpc.FieldDefRequest in project nrtsearch by Yelp.
the class TestIndexManager method registerFields.
protected static void registerFields(LuceneServerClient serverClient, String path) throws IOException {
String registerFieldsJson = readResourceAsString(path);
FieldDefRequest fieldDefRequest = getFieldDefRequest(registerFieldsJson);
FieldDefResponse fieldDefResponse = serverClient.getBlockingStub().registerFields(fieldDefRequest);
logger.info(fieldDefResponse.getResponse());
}
use of com.yelp.nrtsearch.server.grpc.FieldDefRequest in project nrtsearch by Yelp.
the class TestIndexManager method getFieldDefRequest.
private static FieldDefRequest getFieldDefRequest(String jsonStr) {
logger.debug("Converting fields {} to proto FieldDefRequest", jsonStr);
FieldDefRequest.Builder fieldDefRequestBuilder = FieldDefRequest.newBuilder();
try {
JsonFormat.parser().merge(jsonStr, fieldDefRequestBuilder);
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e);
}
FieldDefRequest fieldDefRequest = fieldDefRequestBuilder.build();
logger.debug("jsonStr converted to proto FieldDefRequest {}", fieldDefRequest);
return fieldDefRequest;
}
use of com.yelp.nrtsearch.server.grpc.FieldDefRequest in project nrtsearch by Yelp.
the class YelpReviewsTest method getFieldDefRequest.
static FieldDefRequest getFieldDefRequest(String jsonStr) {
logger.debug("Converting fields {} to proto FieldDefRequest", jsonStr);
FieldDefRequest.Builder fieldDefRequestBuilder = FieldDefRequest.newBuilder();
try {
JsonFormat.parser().merge(jsonStr, fieldDefRequestBuilder);
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e);
}
FieldDefRequest fieldDefRequest = fieldDefRequestBuilder.build();
logger.debug("jsonStr converted to proto FieldDefRequest {}", fieldDefRequest);
return fieldDefRequest;
}
use of com.yelp.nrtsearch.server.grpc.FieldDefRequest in project nrtsearch by Yelp.
the class YelpReviewsTest method registerFields.
private static void registerFields(LuceneServerClient serverClient) throws IOException {
String registerFieldsJson = readResourceAsString("register_fields.json", ServerType.unknown);
FieldDefRequest fieldDefRequest = getFieldDefRequest(registerFieldsJson);
FieldDefResponse fieldDefResponse = serverClient.getBlockingStub().registerFields(fieldDefRequest);
logger.info(fieldDefResponse.getResponse());
}
use of com.yelp.nrtsearch.server.grpc.FieldDefRequest in project nrtsearch by Yelp.
the class NodeNameResolverAndLoadBalancingTests method startIndexAndAddDocuments.
private void startIndexAndAddDocuments(GrpcServer server, int id) throws InterruptedException, IOException {
LuceneServerGrpc.LuceneServerBlockingStub stub = server.getBlockingStub();
stub.createIndex(CreateIndexRequest.newBuilder().setIndexName(TEST_INDEX).build());
FieldDefRequest fieldDefRequest = FieldDefRequest.newBuilder().setIndexName(TEST_INDEX).addField(Field.newBuilder().setName(FIELD_NAME).setType(FieldType.INT).setSearch(true).setStoreDocValues(true).build()).build();
stub.registerFields(fieldDefRequest);
stub.startIndex(StartIndexRequest.newBuilder().setIndexName(TEST_INDEX).build());
AddDocumentRequest addDocumentRequest = AddDocumentRequest.newBuilder().setIndexName(TEST_INDEX).putFields(FIELD_NAME, AddDocumentRequest.MultiValuedField.newBuilder().addValue(String.valueOf(id)).build()).build();
new GrpcServer.TestServer(server, false, Mode.STANDALONE).addDocumentsFromStream(Stream.of(addDocumentRequest));
stub.commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build());
stub.refresh(RefreshRequest.newBuilder().setIndexName(TEST_INDEX).build());
}
Aggregations