From c17df145bbf7e184d1495e9a00c09a02ed0cd076 Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Wed, 22 Oct 2025 12:45:05 -0700 Subject: [PATCH] docs(#373): verify sortBy already implemented for VectorQuery and VectorRangeQuery Issue #373 requested adding sortBy support to VectorQuery and VectorRangeQuery. Investigation reveals this feature is already fully implemented: Implementation: - VectorQuery: sortBy() and sortDescending() methods (lines 817-831) - VectorRangeQuery: sortBy() and sortDescending() methods (lines 367-381) - SearchIndex.searchWithSort() applies sorting via Jedis (lines 1360-1399) - Sorting parameters properly passed through query execution pipeline Test Coverage: - QuerySortingIntegrationTest with 4 passing tests - testSortVectorQuery: ascending sort verification - testSortVectorQueryDescending: descending sort verification - testSortVectorRangeQuery: range query sorting - testSortFilterQueryAlreadyWorks: baseline comparison Changes: - Removed outdated test comments claiming methods don't exist - No implementation changes needed Tests: 282 passed, 14 skipped (API keys) Closes #373 - feature already complete with full test coverage --- .../java/com/redis/vl/query/QuerySortingIntegrationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/com/redis/vl/query/QuerySortingIntegrationTest.java b/core/src/test/java/com/redis/vl/query/QuerySortingIntegrationTest.java index e11d89d..5ee7064 100644 --- a/core/src/test/java/com/redis/vl/query/QuerySortingIntegrationTest.java +++ b/core/src/test/java/com/redis/vl/query/QuerySortingIntegrationTest.java @@ -179,7 +179,7 @@ void testSortVectorQuery() { .field("user_embedding") .vector(new float[] {0.1f, 0.1f, 0.5f}) .returnFields(List.of("user", "credit_score", "age", "job", "location", "last_updated")) - .sortBy("age") // THIS WILL FAIL - sortBy doesn't exist yet! + .sortBy("age") .build(); List> results = index.query(query); @@ -244,7 +244,7 @@ void testSortVectorQueryDescending() { .vector(new float[] {0.1f, 0.1f, 0.5f}) .returnFields(List.of("user", "age")) .sortBy("age") - .sortDescending(true) // THIS WILL FAIL - sortDescending doesn't exist yet! + .sortDescending(true) .build(); List> results = index.query(query);