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

CBL-5324: Vector Index Tests 1-5 #3230

Merged
merged 6 commits into from
Feb 16, 2024
Merged

CBL-5324: Vector Index Tests 1-5 #3230

merged 6 commits into from
Feb 16, 2024

Conversation

velicuvlad
Copy link
Contributor

  • First 5 vector search tests passing on local
  • Update LiteCore to 3.2.0-137

Disabled tests so that they dont run in Jenkins as the library doesn't exist.

@velicuvlad
Copy link
Contributor Author

Once you open the project with XCode, add the vector search extension under Frameworks in root directory and set as follows:
image.

@@ -131,7 +135,7 @@ - (void) reopenDB {
Assert([_db close: &error], @"Close error: %@", error);
_db = nil;
}
[self openDB];
[self initDB];
Copy link
Contributor

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.

[self openDB];
}

- (NSString*) databasePath: (NSString*)fileName inDirectory: (NSString*)dir {
Copy link
Contributor

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.

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];
Copy link
Contributor

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]);

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];
Copy link
Contributor

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];
Copy link
Contributor

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.

@pasin
Copy link
Contributor

pasin commented Feb 16, 2024

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.

@velicuvlad velicuvlad merged commit dca3435 into master Feb 16, 2024
8 of 9 checks passed
@velicuvlad velicuvlad deleted the CBL-5324 branch February 16, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants