Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Redis tests failure logs #231

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ private static Stream<Arguments> provideSearchParameters() {
);
}

private final String indexingFailureMessage = "If you are running in a slow machine, data might not be indexed yet. Adjust setup delay if needed";

@ParameterizedTest
@MethodSource("provideSearchParameters")
public void search(RecordCollectionOptions options, String embeddingName) {
Expand All @@ -385,9 +387,9 @@ public void search(RecordCollectionOptions options, String embeddingName) {
// Embeddings similar to the third hotel
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(SEARCH_EMBEDDINGS, searchOptions).block();
assertNotNull(results);
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size());
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size(), indexingFailureMessage);
// The third hotel should be the most similar
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId());
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId(), indexingFailureMessage);
// Score should be different than zero
assertNotEquals(0.0, results.get(0).getScore());
assertNull(results.get(0).getRecord().getEuclidean());
Expand All @@ -410,9 +412,9 @@ public void searchWithVectors(RecordCollectionOptions options, String embeddingN
// Embeddings similar to the third hotel
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(SEARCH_EMBEDDINGS, searchOptions).block();
assertNotNull(results);
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size());
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size(), indexingFailureMessage);
// The third hotel should be the most similar
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId());
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId(), indexingFailureMessage);
assertNotNull(results.get(0).getRecord().getEuclidean());
}

Expand All @@ -434,8 +436,8 @@ public void searchWithOffSet(RecordCollectionOptions options, String embeddingNa
// Embeddings similar to the third hotel
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(SEARCH_EMBEDDINGS, searchOptions).block();
assertNotNull(results);
assertEquals(4, results.size());
assertEquals(4, results.size(), indexingFailureMessage);
// The first hotel should be the most similar
assertEquals(hotels.get(0).getId(), results.get(0).getRecord().getId());
assertEquals(hotels.get(0).getId(), results.get(0).getRecord().getId(), indexingFailureMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ private static Stream<Arguments> provideSearchParameters() {
);
}

private final String indexingFailureMessage = "If you are running in a slow machine, data might not be indexed yet. Adjust setup delay if needed";

@ParameterizedTest
@MethodSource("provideSearchParameters")
public void search(RecordCollectionOptions options, String embeddingName) {
Expand All @@ -385,9 +387,9 @@ public void search(RecordCollectionOptions options, String embeddingName) {
// Embeddings similar to the third hotel
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(SEARCH_EMBEDDINGS, searchOptions).block();
assertNotNull(results);
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size());
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size(), indexingFailureMessage);
// The third hotel should be the most similar
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId());
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId(), indexingFailureMessage);
// Score should be different than zero
assertNotEquals(0.0, results.get(0).getScore());
assertNull(results.get(0).getRecord().getEuclidean());
Expand All @@ -410,9 +412,9 @@ public void searchWithVectors(RecordCollectionOptions options, String embeddingN
// Embeddings similar to the third hotel
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(SEARCH_EMBEDDINGS, searchOptions).block();
assertNotNull(results);
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size());
assertEquals(VectorSearchOptions.DEFAULT_RESULT_LIMIT, results.size(), indexingFailureMessage);
// The third hotel should be the most similar
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId());
assertEquals(hotels.get(2).getId(), results.get(0).getRecord().getId(), indexingFailureMessage);
assertNotNull(results.get(0).getRecord().getEuclidean());
}

Expand All @@ -434,8 +436,8 @@ public void searchWithOffSet(RecordCollectionOptions options, String embeddingNa
// Embeddings similar to the third hotel
List<VectorSearchResult<Hotel>> results = recordCollection.searchAsync(SEARCH_EMBEDDINGS, searchOptions).block();
assertNotNull(results);
assertEquals(4, results.size());
assertEquals(4, results.size(), indexingFailureMessage);
// The first hotel should be the most similar
assertEquals(hotels.get(0).getId(), results.get(0).getRecord().getId());
assertEquals(hotels.get(0).getId(), results.get(0).getRecord().getId(), indexingFailureMessage);
}
}