Skip to content

Commit

Permalink
Merge 3.2.1 RC2 (#3338)
Browse files Browse the repository at this point in the history
* CBL-5524 : Add all keys to the Privacy Manifest file (#3258)
* CBL-5541 : Update vector search test per changes in v1.8 (#3260)
* CBL-5365: Remove CBLErrors.h from Swift Public API (#3271)
* CBL-5508: Update Min macOS Support Version to 12.0 (#3272)
* CBL-5693 : Fix missing exported symbols (#3281)
* CBL-5222: MutableDocument should be usable before creating a database instance (#3278)
* CBL-5613: Swift API docs for Scope using Obj-c reference (#3284)
* CBL-5710: Add note that the replicator cannot be started in the inBatch() function (#3286)
* CBL-5514: Swift MutableDocument's collection is not set when a new document is saved (#3287)
* CBL-5660 : Fix a released query context may be used in observer callback (#3285)
* CBL-5668: Get Code Coverage at least 80% (#3289)
* CBL-3385: Allow null expression parameter for Function.count(expression) (#3290)
* CBL-5750  + CBL-5757  Lazy Index - ObjC (#3291)
* CBL-5811 : Support Vector Dimension to 4096 and Vector in Base64 String (#3294)
* CBL-5803 : Implement Lazy Vector Index and Test for Swift (#3295)
* CBL-5567 : Implement log replicator heiroglyphics (#3296)
* CBL-5859 : Allow explicitly enable vector search (#3297)
* CBL-5886: Add missing numProbes and correct min/maxTrainingSize default value (#3298)
* CBL-5932: Update default constants and public symbols (#3299)
* CBL-5928 : CBLErrors.h is not included in the umbrella header (#3301)
* CBL-5927 : Fix Duplicate CBLQueryIndex Interface Definition (#3300)
* CBL-5893: Throw exception for everything if finish() was successfully called beforehand (#3302)
* CBL-5956: Update DistanceMetric (#3303)
* CBL-5690 : Update Distance Metric Enum and VS SQL in Tests (#3304)
* CBL-5990 : Fix _kCBLDefaultLogFileUsePlaintext symbol (#3305)
* CBL-6070: Implement Database Full-Sync Option (#3318)
* CBL-6144: Add testConcurrentCreateAndQuery to verify query's lock (#3320)
* CBL-6191 : Fix null URL for proxy CONNECT request (#3324)
* CBL-5180: Implement Array Index API (#3327)
* CBL-5181: Array Index API tests and adjustments (#3330)
* CBL-5899
* CBL-6307: Database MMap Configuration API and tests (#3333)
* CBL-6349: Implement Document's getRevisionHistory() for E2E Test Server (#3335)
* LiteCore 3.2.1-19
* Export symbol for mmap constant (#3341)
* ArrayIndexConfiguration explicit expressions arg on set (#3342)

---------

Co-authored-by: Pasin Suriyentrakorn <[email protected]>
  • Loading branch information
velicuvlad and pasin authored Nov 11, 2024
1 parent c2e3d73 commit e4a61a4
Show file tree
Hide file tree
Showing 50 changed files with 1,188 additions and 233 deletions.
44 changes: 42 additions & 2 deletions CouchbaseLite.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions Objective-C/CBLArrayIndexConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// CBLArrayIndexConfiguration.h
// CouchbaseLite
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import <Foundation/Foundation.h>
#import <CouchbaseLite/CBLIndexConfiguration.h>

NS_ASSUME_NONNULL_BEGIN

/**
Configuration for indexing property values within nested arrays in documents,
intended for use with the UNNEST query.
*/

@interface CBLArrayIndexConfiguration : CBLIndexConfiguration

/**
Path to the array, which can be nested.
*/

@property (nonatomic, readonly) NSString* path;

/**
The expressions representing the values within the array to be indexed.
*/

@property (nonatomic, readonly, nullable) NSArray<NSString*>* expressions;

/**
Initializes the configuration with paths to the nested array
and the optional expressions for the values within the arrays to be indexed.
@param path Path to the array, which can be nested to be indexed.
@note Use "[]" to represent a property that is an array of each nested
array level. For a single array or the last level array, the "[]" is optional.
For instance, use "contacts[].phones" to specify an array of phones within
each contact.
@param expressions An optional array of strings, where each string
represents an expression defining the values within the array
to be indexed. If the array specified by the path contains
scalar values, this parameter can be null.
@return The CBLArrayIndexConfiguration object.
*/

- (instancetype) initWithPath: (NSString*)path
expressions: (nullable NSArray<NSString*>*)expressions;

@end

NS_ASSUME_NONNULL_END
60 changes: 60 additions & 0 deletions Objective-C/CBLArrayIndexConfiguration.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// CBLArrayIndexConfiguration.m
// CouchbaseLite
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "CBLArrayIndexConfiguration.h"
#import "CBLIndexConfiguration+Internal.h"

@implementation CBLArrayIndexConfiguration

@synthesize path=_path, expressions=_expressions;

- (instancetype) initWithPath: (NSString*) path
expressions: (nullable NSArray<NSString*>*)expressions {

if(!expressions) {
self = [super initWithIndexType: kC4ArrayIndex
expressions: @[@""]];
} else if ([expressions count] == 0 || [expressions[0] length] == 0) {
[NSException raise: NSInvalidArgumentException format:
@"Empty expressions is not allowed, use nil instead"];
} else {
self = [super initWithIndexType: kC4ArrayIndex
expressions: expressions];
}

if (self) {
_path = path;
_expressions = expressions;
}

return self;
}

- (instancetype) initWithPath: (NSString*)path {
self = [self initWithPath: path expressions: nil];
return self;
}

- (C4IndexOptions) indexOptions {
C4IndexOptions c4options = { };
c4options.unnestPath = [_path UTF8String];
return c4options;
}

@end
Loading

0 comments on commit e4a61a4

Please sign in to comment.