-
Notifications
You must be signed in to change notification settings - Fork 298
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
CBL-5324: Vector Index Tests 1-5 #3230
Conversation
Objective-C/Tests/CBLTestCase.m
Outdated
@@ -131,7 +135,7 @@ - (void) reopenDB { | |||
Assert([_db close: &error], @"Close error: %@", error); | |||
_db = nil; | |||
} | |||
[self openDB]; | |||
[self initDB]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should call [self openDB] otherwise if calling this in the VectorSearchTest, it will do the copy again.
Objective-C/Tests/VectorSearchTest.m
Outdated
[self openDB]; | ||
} | ||
|
||
- (NSString*) databasePath: (NSString*)fileName inDirectory: (NSString*)dir { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to move this method to CBLTestCase so it can be shared with MigrationTest.
Objective-C/Tests/VectorSearchTest.m
Outdated
CBLCollection* collection = [_db collectionWithName: @"words" scope: nil error: nil]; | ||
CBLVectorIndexConfiguration* config = [[CBLVectorIndexConfiguration alloc] initWithExpression: @"vector" dimensions: 300 centroids: 10]; | ||
|
||
[collection createIndexWithName: @"words_index" config: config error: &error]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert the boolean result to check that the create index was successful.
Assert([collection createIndexWithName: @"words_index" config: config error: &error]);
Objective-C/Tests/VectorSearchTest.m
Outdated
AssertEqualObjects(names, (@[@"words_index"])); | ||
|
||
NSString* sql = @"select meta().id, word from _default.words where vector_match(words_index, $vector, 300)"; | ||
CBLMutableArray* dinnerArray = [[CBLMutableArray alloc] initWithData: kDinnerVector]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just do [parameters setValue: kDinnerVector forName: @"vector"].
|
||
CBLQuery* q = [_db createQuery: sql error: &error]; | ||
[q setParameters: parameters]; | ||
NSString* explain = [q explain: &error]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More readable when having an empty line before this line as explain is not related to set parameter at all.
The testCollectionConflictResolver failure is not related to this PR. I have fixed the bug in the test in 3.1 branch and that needs to be ported here. |
Disabled tests so that they dont run in Jenkins as the library doesn't exist.