Skip to content

Commit

Permalink
CBL-5886: Add missing numProbes and correct min/maxTrainingSize defau…
Browse files Browse the repository at this point in the history
…lt value (#3298)

* add numProbes property and fix tests

* all VS tests enabled now

* LiteCore 3.2.0-210

* update VS to 1.0.0-52

* rename test class names
  • Loading branch information
velicuvlad authored Jul 1, 2024
1 parent 58ad341 commit c22c095
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 112 deletions.
24 changes: 12 additions & 12 deletions CouchbaseLite.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,12 @@
406F8DEB2C26901A000223FC /* QueryIndex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 406F8DEA2C26901A000223FC /* QueryIndex.swift */; };
406F8DEC2C26901A000223FC /* QueryIndex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 406F8DEA2C26901A000223FC /* QueryIndex.swift */; };
406F8DFB2C27C303000223FC /* IndexUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 406F8DF92C27C302000223FC /* IndexUpdater.swift */; };
406F8DFF2C27F0A9000223FC /* LazyVectorIndexTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 406F8DFC2C27F097000223FC /* LazyVectorIndexTest.swift */; };
406F8E002C27F0AB000223FC /* LazyVectorIndexTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 406F8DFC2C27F097000223FC /* LazyVectorIndexTest.swift */; };
406F8DFF2C27F0A9000223FC /* VectorLazyIndexTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 406F8DFC2C27F097000223FC /* VectorLazyIndexTest.swift */; };
406F8E002C27F0AB000223FC /* VectorLazyIndexTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 406F8DFC2C27F097000223FC /* VectorLazyIndexTest.swift */; };
40AA72952C28938D007FB1E0 /* VectorSearchTest.m in Sources */ = {isa = PBXBuildFile; fileRef = AE006DE62B7BB98B00884E2B /* VectorSearchTest.m */; };
40AA72962C28938E007FB1E0 /* VectorSearchTest.m in Sources */ = {isa = PBXBuildFile; fileRef = AE006DE62B7BB98B00884E2B /* VectorSearchTest.m */; };
40AA729D2C28B1A3007FB1E0 /* LazyVectorIndexTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 40AA72972C28B1A3007FB1E0 /* LazyVectorIndexTest.m */; };
40AA729E2C28B1A3007FB1E0 /* LazyVectorIndexTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 40AA72972C28B1A3007FB1E0 /* LazyVectorIndexTest.m */; };
40AA729D2C28B1A3007FB1E0 /* VectorLazyIndexTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 40AA72972C28B1A3007FB1E0 /* VectorLazyIndexTest.m */; };
40AA729E2C28B1A3007FB1E0 /* VectorLazyIndexTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 40AA72972C28B1A3007FB1E0 /* VectorLazyIndexTest.m */; };
40C5FD5B2B9947B3004BFD3B /* CBLVectorIndexTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 40C5FD5A2B9946E6004BFD3B /* CBLVectorIndexTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
40C5FD5C2B9947B9004BFD3B /* CBLVectorIndexTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 40C5FD5A2B9946E6004BFD3B /* CBLVectorIndexTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
40EF690C2B7757CF00F0CB50 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 40EF690A2B77564000F0CB50 /* PrivacyInfo.xcprivacy */; };
Expand Down Expand Up @@ -2287,13 +2287,13 @@
4017E4642BED6E5400A438EE /* CBLContextManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBLContextManager.m; sourceTree = "<group>"; };
406F8DEA2C26901A000223FC /* QueryIndex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueryIndex.swift; sourceTree = "<group>"; };
406F8DF92C27C302000223FC /* IndexUpdater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndexUpdater.swift; sourceTree = "<group>"; };
406F8DFC2C27F097000223FC /* LazyVectorIndexTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyVectorIndexTest.swift; sourceTree = "<group>"; };
406F8DFC2C27F097000223FC /* VectorLazyIndexTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VectorLazyIndexTest.swift; sourceTree = "<group>"; };
40A789282BE2C7D100CA43A1 /* CBL_EE.exp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.exports; path = CBL_EE.exp; sourceTree = "<group>"; };
40A789292BE2C7D100CA43A1 /* CBL.exp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.exports; path = CBL.exp; sourceTree = "<group>"; };
40A7892B2BE2C7D100CA43A1 /* CBL_EE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CBL_EE.txt; sourceTree = "<group>"; };
40A7892C2BE2C7D100CA43A1 /* CBL.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CBL.txt; sourceTree = "<group>"; };
40A7892D2BE2C7D100CA43A1 /* generate_exports.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = generate_exports.sh; sourceTree = "<group>"; };
40AA72972C28B1A3007FB1E0 /* LazyVectorIndexTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LazyVectorIndexTest.m; sourceTree = "<group>"; };
40AA72972C28B1A3007FB1E0 /* VectorLazyIndexTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VectorLazyIndexTest.m; sourceTree = "<group>"; };
40AA72A12C28B1F2007FB1E0 /* VectorSearchTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VectorSearchTest.h; sourceTree = "<group>"; };
40C5FD5A2B9946E6004BFD3B /* CBLVectorIndexTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CBLVectorIndexTypes.h; sourceTree = "<group>"; };
40E905462B5B6D9D00EDF483 /* CouchbaseLiteSwift.private.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = CouchbaseLiteSwift.private.modulemap; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3079,7 +3079,7 @@
934608EE247F35CC00CF2F27 /* URLEndpointListenerTest.swift */,
1A13DD3328B8809300BC1084 /* URLEndpointListenerTest+Collection.swift */,
AE5803A32B99C67D001A1BE3 /* VectorSearchTest.swift */,
406F8DFC2C27F097000223FC /* LazyVectorIndexTest.swift */,
406F8DFC2C27F097000223FC /* VectorLazyIndexTest.swift */,
1AA91DC522B0356000BF0BDE /* CustomLogger.swift */,
93249D81246B99FD000A8A6E /* iOS */,
939B79241E679017009A70EF /* Info.plist */,
Expand Down Expand Up @@ -4147,7 +4147,7 @@
1AA3D77222AB06E10098E16B /* CustomLogger.m */,
40AA72A12C28B1F2007FB1E0 /* VectorSearchTest.h */,
AE006DE62B7BB98B00884E2B /* VectorSearchTest.m */,
40AA72972C28B1A3007FB1E0 /* LazyVectorIndexTest.m */,
40AA72972C28B1A3007FB1E0 /* VectorLazyIndexTest.m */,
93DECF3E200DBE5800F44953 /* Support */,
936483AA1E4431C6008D08B3 /* iOS */,
275FF5FA1E3FBD3B005F90DD /* Performance */,
Expand Down Expand Up @@ -6267,7 +6267,7 @@
93BB1C9E246BB2BF004FFA00 /* DatabaseTest.swift in Sources */,
93BB1C9C246BB2BB004FFA00 /* CBLTestCase.swift in Sources */,
93BB1CB8246BB2F4004FFA00 /* ReplicatorTest+CustomConflict.swift in Sources */,
406F8E002C27F0AB000223FC /* LazyVectorIndexTest.swift in Sources */,
406F8E002C27F0AB000223FC /* VectorLazyIndexTest.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -6694,7 +6694,7 @@
1A621D7A2887DCFD0017F905 /* QueryTest+Collection.m in Sources */,
93EB25CC21CDD12A0006FB88 /* PredictiveQueryTest.m in Sources */,
1AF555D422948BD90077DF6D /* QueryTest+Main.m in Sources */,
40AA729D2C28B1A3007FB1E0 /* LazyVectorIndexTest.m in Sources */,
40AA729D2C28B1A3007FB1E0 /* VectorLazyIndexTest.m in Sources */,
9343F13D207D61EC00F19A89 /* MigrationTest.m in Sources */,
9343F13E207D61EC00F19A89 /* DocumentTest.m in Sources */,
9343F140207D61EC00F19A89 /* DictionaryTest.m in Sources */,
Expand Down Expand Up @@ -6748,7 +6748,7 @@
1AA6744C227924130018CC6D /* QueryTest+Meta.m in Sources */,
934EF8322460D07B0053A47C /* TLSIdentityTest.m in Sources */,
9369A6AF207DD105009B5B83 /* DatabaseEncryptionTest.m in Sources */,
40AA729E2C28B1A3007FB1E0 /* LazyVectorIndexTest.m in Sources */,
40AA729E2C28B1A3007FB1E0 /* VectorLazyIndexTest.m in Sources */,
9343F176207D633300F19A89 /* DocumentTest.m in Sources */,
1A13DD4228B882A800BC1084 /* URLEndpointListenerTest+Main.m in Sources */,
9388CBAE21BD9187005CA66D /* DocumentExpirationTest.m in Sources */,
Expand Down Expand Up @@ -6810,7 +6810,7 @@
9343F198207D636300F19A89 /* CBLTestCase.swift in Sources */,
93C50EB021BDFC7B00C7E980 /* DocumentExpirationTest.swift in Sources */,
9369A6B7207DEB60009B5B83 /* DatabaseEncryptionTest.swift in Sources */,
406F8DFF2C27F0A9000223FC /* LazyVectorIndexTest.swift in Sources */,
406F8DFF2C27F0A9000223FC /* VectorLazyIndexTest.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

#define LAZY_VECTOR_INDEX_CONFIG(E, D, C) [self lazyVectorIndexConfigWithExpression: (E) dimensions: (D) centroids: (C)]

@interface LazyVectorIndexTest : VectorSearchTest
@interface VectorLazyIndexTest : VectorSearchTest

@end

@implementation LazyVectorIndexTest
@implementation VectorLazyIndexTest

- (CBLQueryIndex*) wordsIndex {
CBLQueryIndex* index = [self.wordsCollection indexWithName: kWordsIndexName error: nil];
Expand Down Expand Up @@ -208,7 +208,7 @@ - (void) testGetExistingVectorIndex {
* 3. Create an SQL++ query:
* - SELECT word
* FROM _default.words
* WHERE vector_match(words_index, < dinner vector >)
* WHERE vector_match(words_index, <dinner vector>)
* 4. Execute the query and check that 0 results are returned.
* 5. Update the documents:
* - Create _default.words.word301 with the content from _default.extwords.word1
Expand Down Expand Up @@ -261,7 +261,7 @@ - (void) testLazyVectorIndexNotAutoUpdatedChangedDocs {
* 6. Create an SQL++ query:
* - SELECT word
* FROM _default.words
* WHERE vector_match(words_index, < dinner vector >, 300)
* WHERE vector_match(words_index, <dinner vector>) LIMIT 300
* 7. Execute the query and check that 1 results are returned.
* 8. Check that the word gotten from the query result is the same as the word in Step 5.
* 9. Delete _default.words.word1 doc.
Expand Down Expand Up @@ -318,7 +318,7 @@ - (void) testLazyVectorIndexAutoUpdateDeletedDocs {
* 7. Create an SQL++ query:
* - SELECT word
* FROM _default.words
* WHERE vector_match(words_index, < dinner vector >, 300)
* WHERE vector_match(words_index, <dinner vector>) LIMIT 300
* 8. Execute the query and check that 1 results are returned.
* 9. Check that the word gotten from the query result is the same as the word in Step 5.
* 10. Purge _default.words.word1 doc.
Expand Down Expand Up @@ -827,7 +827,7 @@ - (void) testIndexUpdaterGettingValues {
* 7. Execute a vector search query.
* - SELECT word
* FROM _default.words
* WHERE vector_match(words_index, < dinner vector >, 300)
* WHERE vector_match(words_index, <dinner vector>) LIMIT 300
* 8. Check that there are 10 words returned.
* 9. Check that the word is in the word set from the step 5.
*/
Expand Down Expand Up @@ -884,8 +884,7 @@ - (void) testIndexUpdaterSetFloatArrayVectors {
* 5. With the IndexUpdater object, call setVector() with a float array as [1.0]
* 6. Check that the setVector throws CouchbaseLiteException with the InvalidParameter error.
*/
// CBL-5814
- (void) _testIndexUpdaterSetInvalidVectorDimensions {
- (void) testIndexUpdaterSetInvalidVectorDimensions {
[self createWordsIndexWithConfig: LAZY_VECTOR_INDEX_CONFIG(@"word", 300, 8)];

NSError* error;
Expand Down Expand Up @@ -1091,7 +1090,7 @@ - (void) testIndexUpdaterCaughtUp {
* 7. Execute a vector search query.
* - SELECT word
* FROM _default.words
* WHERE vector_match(words_index, < dinner vector >, 300)
* WHERE vector_match(words_index, <dinner vector>) LIMIT 300
* 8. Check that there are 0 words returned.
*/

Expand Down Expand Up @@ -1247,10 +1246,9 @@ - (void) testIndexUpdaterIndexOutOfBounds {
* - Convert the vector result which is an array object to a platform's float array.
* - Call setVector() with the platform's float array at the index..
* 8. Call finish() and check that the finish() is successfully called.
* 9. Call finish() again and check that a CouchbaseLiteException with the code Unsupported is thrown.
* 9. Call finish() again and check that a CouchbaseLiteException with the code NotOpen is thrown.
*/
// CBL-5843
- (void) _testIndexUpdaterCallFinishTwice {
- (void) testIndexUpdaterCallFinishTwice {
[self createWordsIndexWithConfig: LAZY_VECTOR_INDEX_CONFIG(@"word", 300, 8)];

NSError* error;
Expand All @@ -1264,7 +1262,7 @@ - (void) _testIndexUpdaterCallFinishTwice {
Assert([updater setVector: vector atIndex: 0 error: &error]);
Assert([updater finishWithError: &error]);

[self expectError: CBLErrorDomain code: CBLErrorUnsupported in: ^BOOL(NSError** err) {
[self expectError: CBLErrorDomain code: CBLErrorNotOpen in: ^BOOL(NSError** err) {
return [updater finishWithError: err];
}];
}
Expand Down
Loading

0 comments on commit c22c095

Please sign in to comment.