Skip to content

Commit

Permalink
Changed doc_id to start from 1
Browse files Browse the repository at this point in the history
  • Loading branch information
fragosoluana committed Dec 17, 2024
1 parent 07e15d4 commit 5173d27
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/test/java/com/yelp/nrtsearch/server/logging/HitsLoggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected FieldDefRequest getIndexDef(String name) throws IOException {
protected void initIndex(String name) throws Exception {
List<AddDocumentRequest> docs = new ArrayList<>();

for (int docNum = 0; docNum < 10; docNum++) {
for (int docNum = 1; docNum < 11; docNum++) {
AddDocumentRequest request =
AddDocumentRequest.newBuilder()
.setIndexName(name)
Expand Down Expand Up @@ -175,7 +175,7 @@ public void testCustomHitsLoggerWithParam() {
.build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED doc_id: 0, doc_id: 1, {external_value=abc}";
String expectedLogMessage = "LOGGED doc_id: 1, doc_id: 2, {external_value=abc}";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand All @@ -202,7 +202,7 @@ public void testCustomHitsLoggerWithoutParam() {
LoggingHits.newBuilder().setName("custom_logger_2").setHitsToLog(2).build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED_2 doc_id: 0, doc_id: 1, ";
String expectedLogMessage = "LOGGED_2 doc_id: 1, doc_id: 2, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand All @@ -229,7 +229,7 @@ public void testResponseSizeReductionWithHitsToLogSameAsHitsCount() {
LoggingHits.newBuilder().setName("custom_logger").setHitsToLog(5).build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED doc_id: 0, doc_id: 1, doc_id: 2, doc_id: 3, doc_id: 4, ";
String expectedLogMessage = "LOGGED doc_id: 1, doc_id: 2, doc_id: 3, doc_id: 4, doc_id: 5, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand Down Expand Up @@ -263,7 +263,7 @@ public void testResponseSizeReductionWithHitsToLogGreaterThanHitsCount() {
.build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED doc_id: 0, doc_id: 1, {external_value=abc}";
String expectedLogMessage = "LOGGED doc_id: 1, doc_id: 2, {external_value=abc}";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand Down Expand Up @@ -291,7 +291,7 @@ public void testResponseSizeReductionWithHitsToLogGreaterThanHitsCountAndTotalDo
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage =
"LOGGED doc_id: 0, doc_id: 1, doc_id: 2, doc_id: 3, doc_id: 4, doc_id: 5, doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, ";
"LOGGED doc_id: 1, doc_id: 2, doc_id: 3, doc_id: 4, doc_id: 5, doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, doc_id: 10, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand All @@ -318,7 +318,7 @@ public void testResponseSizeReductionWithHitsToLogLessThanHitsCount() {
LoggingHits.newBuilder().setName("custom_logger").setHitsToLog(3).build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED doc_id: 0, doc_id: 1, doc_id: 2, ";
String expectedLogMessage = "LOGGED doc_id: 1, doc_id: 2, doc_id: 3, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand All @@ -345,7 +345,7 @@ public void testResponseSizeReductionWithStartHitAndHitsToLogSameAsHitsCount() {
LoggingHits.newBuilder().setName("custom_logger").setHitsToLog(5).build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED doc_id: 5, doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, ";
String expectedLogMessage = "LOGGED doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, doc_id: 10, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand All @@ -372,7 +372,7 @@ public void testResponseSizeReductionWithStartHitAndHitsToLogGreaterThanHitsCoun
LoggingHits.newBuilder().setName("custom_logger").setHitsToLog(6).build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED doc_id: 5, doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, ";
String expectedLogMessage = "LOGGED doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, doc_id: 10, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand Down Expand Up @@ -400,7 +400,7 @@ public void testResponseSizeReductionWithStartHitAndHitsToLogGreaterThanHitsCoun
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage =
"LOGGED doc_id: 4, doc_id: 5, doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, ";
"LOGGED doc_id: 5, doc_id: 6, doc_id: 7, doc_id: 8, doc_id: 9, doc_id: 10, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand All @@ -427,7 +427,7 @@ public void testResponseSizeReductionWithStartHitAndHitsToLogLessThanHitsCount()
LoggingHits.newBuilder().setName("custom_logger").setHitsToLog(3).build())
.build();
SearchResponse response = getGrpcServer().getBlockingStub().search(request);
String expectedLogMessage = "LOGGED doc_id: 5, doc_id: 6, doc_id: 7, ";
String expectedLogMessage = "LOGGED doc_id: 6, doc_id: 7, doc_id: 8, ";

assertEquals(expectedLogMessage, HitsLoggerTest.logMessage);
assertEquals(10, response.getTotalHits().getValue());
Expand Down

0 comments on commit 5173d27

Please sign in to comment.