@@ -53,56 +53,56 @@ public enum RecordCollectionOptions {
5353 @ BeforeAll
5454 static void setup () {
5555 optionsMap .put (RecordCollectionOptions .DEFAULT , RedisHashSetVectorStoreRecordCollectionOptions .<Hotel >builder ()
56- .withRecordClass (Hotel .class )
57- .build ());
56+ .withRecordClass (Hotel .class )
57+ .build ());
5858
5959 List <VectorStoreRecordField > fields = new ArrayList <>();
6060 fields .add (VectorStoreRecordKeyField .builder ()
61- .withName ("id" )
62- .withFieldType (String .class )
63- .build ());
61+ .withName ("id" )
62+ .withFieldType (String .class )
63+ .build ());
6464 fields .add (VectorStoreRecordDataField .builder ()
65- .withName ("name" )
66- .withFieldType (String .class )
67- .build ());
65+ .withName ("name" )
66+ .withFieldType (String .class )
67+ .build ());
6868 fields .add (VectorStoreRecordDataField .builder ()
69- .withName ("code" )
70- .withFieldType (Integer .class )
71- .build ());
69+ .withName ("code" )
70+ .withFieldType (Integer .class )
71+ .build ());
7272 fields .add (VectorStoreRecordDataField .builder ()
73- .withName ("description" )
74- .withStorageName ("summary" )
75- .withFieldType (String .class )
76- .build ());
73+ .withName ("description" )
74+ .withStorageName ("summary" )
75+ .withFieldType (String .class )
76+ .build ());
7777 fields .add (VectorStoreRecordVectorField .builder ()
78- .withName ("euclidean" )
79- .withStorageName ("summaryEmbedding1" )
80- .withFieldType (List .class )
81- .withDimensions (8 )
82- .build ());
78+ .withName ("euclidean" )
79+ .withStorageName ("summaryEmbedding1" )
80+ .withFieldType (List .class )
81+ .withDimensions (8 )
82+ .build ());
8383 fields .add (VectorStoreRecordVectorField .builder ()
84- .withName ("cosineDistance" )
85- .withStorageName ("summaryEmbedding2" )
86- .withFieldType (List .class )
87- .withDimensions (8 )
88- .build ());
84+ .withName ("cosineDistance" )
85+ .withStorageName ("summaryEmbedding2" )
86+ .withFieldType (List .class )
87+ .withDimensions (8 )
88+ .build ());
8989 fields .add (VectorStoreRecordVectorField .builder ()
90- .withName ("dotProduct" )
91- .withStorageName ("summaryEmbedding3" )
92- .withFieldType (List .class )
93- .withDimensions (8 )
94- .build ());
90+ .withName ("dotProduct" )
91+ .withStorageName ("summaryEmbedding3" )
92+ .withFieldType (List .class )
93+ .withDimensions (8 )
94+ .build ());
9595 fields .add (VectorStoreRecordDataField .builder ()
96- .withName ("rating" )
97- .withFieldType (Double .class )
98- .isFilterable (true )
99- .build ());
96+ .withName ("rating" )
97+ .withFieldType (Double .class )
98+ .isFilterable (true )
99+ .build ());
100100 VectorStoreRecordDefinition recordDefinition = VectorStoreRecordDefinition .fromFields (fields );
101101
102102 optionsMap .put (RecordCollectionOptions .WITH_CUSTOM_DEFINITION , RedisHashSetVectorStoreRecordCollectionOptions .<Hotel >builder ()
103- .withRecordClass (Hotel .class )
104- .withRecordDefinition (recordDefinition )
105- .build ());
103+ .withRecordClass (Hotel .class )
104+ .withRecordDefinition (recordDefinition )
105+ .build ());
106106
107107 // Search configuration
108108 List <Hotel > hotels = getHotels ();
@@ -127,20 +127,20 @@ static void setup() {
127127
128128 private static RedisHashSetVectorStoreRecordCollection <Hotel > createCollection (@ Nonnull RedisHashSetVectorStoreRecordCollectionOptions <Hotel > options , @ Nonnull String collectionName ) {
129129 return new RedisHashSetVectorStoreRecordCollection <>(new JedisPooled (redisContainer .getRedisURI ()), collectionName , RedisHashSetVectorStoreRecordCollectionOptions .<Hotel >builder ()
130- .withRecordClass (options .getRecordClass ())
131- .withVectorStoreRecordMapper (options .getVectorStoreRecordMapper ())
132- .withRecordDefinition (options .getRecordDefinition ())
133- .withPrefixCollectionName (options .isPrefixCollectionName ())
134- .build ());
130+ .withRecordClass (options .getRecordClass ())
131+ .withVectorStoreRecordMapper (options .getVectorStoreRecordMapper ())
132+ .withRecordDefinition (options .getRecordDefinition ())
133+ .withPrefixCollectionName (options .isPrefixCollectionName ())
134+ .build ());
135135 }
136136
137137 private static List <Hotel > getHotels () {
138138 return Arrays .asList (
139- new Hotel ("id_1" , "Hotel 1" , 1 , "Hotel 1 description" , Arrays .asList (0.5f , 3.2f , 7.1f , -4.0f , 2.8f , 10.0f , -1.3f , 5.5f ),null , null , 4.0 ),
140- new Hotel ("id_2" , "Hotel 2" , 2 , "Hotel 2 description" , Arrays .asList (-2.0f , 8.1f , 0.9f , 5.4f , -3.3f , 2.2f , 9.9f , -4.5f ),null , null , 4.0 ),
141- new Hotel ("id_3" , "Hotel 3" , 3 , "Hotel 3 description" , Arrays .asList (4.5f , -6.2f , 3.1f , 7.7f , -0.8f , 1.1f , -2.2f , 8.3f ),null , null , 5.0 ),
142- new Hotel ("id_4" , "Hotel 4" , 4 , "Hotel 4 description" , Arrays .asList (7.0f , 1.2f , -5.3f , 2.5f , 6.6f , -7.8f , 3.9f , -0.1f ),null , null , 4.0 ),
143- new Hotel ("id_5" , "Hotel 5" , 5 , "Hotel 5 description" , Arrays .asList (-3.5f , 4.4f , -1.2f , 9.9f , 5.7f , -6.1f , 7.8f , -2.0f ),null , null , 4.0 )
139+ new Hotel ("id_1" , "Hotel 1" , 1 , "Hotel 1 description" , Arrays .asList (0.5f , 3.2f , 7.1f , -4.0f , 2.8f , 10.0f , -1.3f , 5.5f ),null , null , 4.0 ),
140+ new Hotel ("id_2" , "Hotel 2" , 2 , "Hotel 2 description" , Arrays .asList (-2.0f , 8.1f , 0.9f , 5.4f , -3.3f , 2.2f , 9.9f , -4.5f ),null , null , 4.0 ),
141+ new Hotel ("id_3" , "Hotel 3" , 3 , "Hotel 3 description" , Arrays .asList (4.5f , -6.2f , 3.1f , 7.7f , -0.8f , 1.1f , -2.2f , 8.3f ),null , null , 5.0 ),
142+ new Hotel ("id_4" , "Hotel 4" , 4 , "Hotel 4 description" , Arrays .asList (7.0f , 1.2f , -5.3f , 2.5f , 6.6f , -7.8f , 3.9f , -0.1f ),null , null , 4.0 ),
143+ new Hotel ("id_5" , "Hotel 5" , 5 , "Hotel 5 description" , Arrays .asList (-3.5f , 4.4f , -1.2f , 9.9f , 5.7f , -6.1f , 7.8f , -2.0f ),null , null , 4.0 )
144144 );
145145 }
146146
@@ -362,12 +362,12 @@ public void getBatchAsyncWithNoVectors(RecordCollectionOptions options) {
362362
363363 private static Stream <Arguments > provideSearchParameters () {
364364 return Stream .of (
365- Arguments .of (RecordCollectionOptions .DEFAULT , "euclidean" ),
366- Arguments .of (RecordCollectionOptions .DEFAULT , "cosineDistance" ),
367- Arguments .of (RecordCollectionOptions .DEFAULT , "dotProduct" ),
368- Arguments .of (RecordCollectionOptions .WITH_CUSTOM_DEFINITION , "euclidean" ),
369- Arguments .of (RecordCollectionOptions .WITH_CUSTOM_DEFINITION , "cosineDistance" ),
370- Arguments .of (RecordCollectionOptions .WITH_CUSTOM_DEFINITION , "dotProduct" )
365+ Arguments .of (RecordCollectionOptions .DEFAULT , "euclidean" ),
366+ Arguments .of (RecordCollectionOptions .DEFAULT , "cosineDistance" ),
367+ Arguments .of (RecordCollectionOptions .DEFAULT , "dotProduct" ),
368+ Arguments .of (RecordCollectionOptions .WITH_CUSTOM_DEFINITION , "euclidean" ),
369+ Arguments .of (RecordCollectionOptions .WITH_CUSTOM_DEFINITION , "cosineDistance" ),
370+ Arguments .of (RecordCollectionOptions .WITH_CUSTOM_DEFINITION , "dotProduct" )
371371 );
372372 }
373373
@@ -383,8 +383,8 @@ public void search(RecordCollectionOptions options, String embeddingName) {
383383 recordCollection .upsertBatchAsync (hotels , null ).block ();
384384
385385 VectorSearchOptions searchOptions = VectorSearchOptions .builder ()
386- .withVectorFieldName (embeddingName )
387- .build ();
386+ .withVectorFieldName (embeddingName )
387+ .build ();
388388
389389 // Embeddings similar to the third hotel
390390 List <VectorSearchResult <Hotel >> results = recordCollection .searchAsync (SEARCH_EMBEDDINGS , searchOptions ).block ().getResults ();
@@ -407,9 +407,9 @@ public void searchWithVectors(RecordCollectionOptions options, String embeddingN
407407 recordCollection .upsertBatchAsync (hotels , null ).block ();
408408
409409 VectorSearchOptions searchOptions = VectorSearchOptions .builder ()
410- .withVectorFieldName (embeddingName )
411- .withIncludeVectors (true )
412- .build ();
410+ .withVectorFieldName (embeddingName )
411+ .withIncludeVectors (true )
412+ .build ();
413413
414414 // Embeddings similar to the third hotel
415415 List <VectorSearchResult <Hotel >> results = recordCollection .searchAsync (SEARCH_EMBEDDINGS , searchOptions ).block ().getResults ();
@@ -430,10 +430,10 @@ public void searchWithOffSet(RecordCollectionOptions options, String embeddingNa
430430 recordCollection .upsertBatchAsync (hotels , null ).block ();
431431
432432 VectorSearchOptions searchOptions = VectorSearchOptions .builder ()
433- .withVectorFieldName (embeddingName )
434- .withSkip (1 )
435- .withTop (4 )
436- .build ();
433+ .withVectorFieldName (embeddingName )
434+ .withSkip (1 )
435+ .withTop (4 )
436+ .build ();
437437
438438 // Embeddings similar to the third hotel
439439 List <VectorSearchResult <Hotel >> results = recordCollection .searchAsync (SEARCH_EMBEDDINGS , searchOptions ).block ().getResults ();
@@ -453,16 +453,16 @@ public void searchWithFilterEqualToFilter(RecordCollectionOptions recordCollecti
453453 recordCollection .upsertBatchAsync (hotels , null ).block ();
454454
455455 VectorSearchOptions options = VectorSearchOptions .builder ()
456- .withVectorFieldName (embeddingName )
457- .withTop (3 )
458- .withVectorSearchFilter (
459- VectorSearchFilter .builder ()
460- .equalTo ("rating" , 4.0 ).build ())
461- .build ();
456+ .withVectorFieldName (embeddingName )
457+ .withTop (3 )
458+ .withVectorSearchFilter (
459+ VectorSearchFilter .builder ()
460+ .equalTo ("rating" , 4.0 ).build ())
461+ .build ();
462462
463463 // Embeddings similar to the third hotel, but as the filter is set to 4.0, the third hotel should not be returned
464464 List <VectorSearchResult <Hotel >> results = recordCollection .searchAsync (SEARCH_EMBEDDINGS ,
465- options ).block ().getResults ();
465+ options ).block ().getResults ();
466466 assertNotNull (results );
467467 assertEquals (3 , results .size ());
468468 // The first hotel should be the most similar
0 commit comments