Search in sources :

Example 11 with GrpcServer

use of com.yelp.nrtsearch.server.grpc.GrpcServer in project nrtsearch by Yelp.

the class ScoreScriptTest method testScriptUsingScoreInScoreQuery.

@Test
public void testScriptUsingScoreInScoreQuery() throws Exception {
    GrpcServer.TestServer testAddDocs = new GrpcServer.TestServer(grpcServer, true, Mode.STANDALONE);
    // 2 docs addDocuments
    testAddDocs.addDocuments();
    // manual refresh
    grpcServer.getBlockingStub().refresh(RefreshRequest.newBuilder().setIndexName(grpcServer.getTestIndex()).build());
    SearchResponse searchResponse = doFunctionScoreQuery("verify_score");
    assertEquals(2, searchResponse.getHitsCount());
    assertEquals(2.0, searchResponse.getHits(0).getScore(), Math.ulp(2.0));
    assertEquals(2.0, searchResponse.getHits(1).getScore(), Math.ulp(2.0));
}
Also used : GrpcServer(com.yelp.nrtsearch.server.grpc.GrpcServer) SearchResponse(com.yelp.nrtsearch.server.grpc.SearchResponse) Test(org.junit.Test)

Aggregations

GrpcServer (com.yelp.nrtsearch.server.grpc.GrpcServer)11 SearchResponse (com.yelp.nrtsearch.server.grpc.SearchResponse)7 Test (org.junit.Test)6 LuceneServerConfiguration (com.yelp.nrtsearch.server.config.LuceneServerConfiguration)3 AddDocumentResponse (com.yelp.nrtsearch.server.grpc.AddDocumentResponse)3 VirtualField (com.yelp.nrtsearch.server.grpc.VirtualField)3 GlobalState (com.yelp.nrtsearch.server.luceneserver.GlobalState)2 AddDocumentRequest (com.yelp.nrtsearch.server.grpc.AddDocumentRequest)1 FieldDefRequest (com.yelp.nrtsearch.server.grpc.FieldDefRequest)1 LuceneServerGrpc (com.yelp.nrtsearch.server.grpc.LuceneServerGrpc)1