Skip to content

Commit

Permalink
Update api-walkthrough sample code
Browse files Browse the repository at this point in the history
Updated to use DB018 API.
  • Loading branch information
pasin committed Oct 11, 2017
1 parent 4373a8c commit e446519
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/examples/objc-api-walkthrough/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "couchbase/couchbase-lite-ios" "version/2.0DB014"
github "couchbase/couchbase-lite-ios" "version/2.0DB018"
2 changes: 1 addition & 1 deletion docs/examples/objc-api-walkthrough/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "couchbase/couchbase-lite-ios" "4c948de6142dec8356eb7edf608e418dab5f4c64"
github "couchbase/couchbase-lite-ios" "4373a8c8c4a1ae49be157b8491c1bb1b915625aa"
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ - (void)viewDidLoad {
from:[CBLQueryDataSource database:database]
where:[
[[CBLQueryExpression property:@"type"] equalTo:@"user"]
and: [[CBLQueryExpression property:@"admin"] equalTo:@FALSE]]];
andExpression: [[CBLQueryExpression property:@"admin"] equalTo:@FALSE]]];

NSEnumerator* rows = [query run:&error];
for (CBLQueryRow *row in rows) {
Expand All @@ -103,7 +103,9 @@ - (void)viewDidLoad {
}

// create index
[database createIndexOn:@[@"name"] type:kCBLFullTextIndex options:NULL error:&error];
CBLQueryExpression* name = [CBLQueryExpression property: @"name"];
CBLIndex* index = [CBLIndex ftsIndexOn: [CBLFTSIndexItem expression: name] options: nil];
[database createIndex: index withName: @"name_idx" error: &error];
if (error) {
NSLog(@"Cannot create index %@", error);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/swift-api-walkthrough/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "couchbase/couchbase-lite-ios" "version/2.0DB014"
github "couchbase/couchbase-lite-ios" "version/2.0DB018"
2 changes: 1 addition & 1 deletion docs/examples/swift-api-walkthrough/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "couchbase/couchbase-lite-ios" "4c948de6142dec8356eb7edf608e418dab5f4c64"
github "couchbase/couchbase-lite-ios" "4373a8c8c4a1ae49be157b8491c1bb1b915625aa"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
BE7EDC9A1F02AFE600275629 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE7EDC981F02AFE600275629 /* Main.storyboard */; };
BE7EDC9C1F02AFE600275629 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE7EDC9B1F02AFE600275629 /* Assets.xcassets */; };
BE7EDC9F1F02AFE600275629 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE7EDC9D1F02AFE600275629 /* LaunchScreen.storyboard */; };
BEBFCBF01F3C81DF00F08548 /* mini-travel-sample.cblite2 in Resources */ = {isa = PBXBuildFile; fileRef = BEBFCBEF1F3C81DF00F08548 /* mini-travel-sample.cblite2 */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -43,7 +42,6 @@
BE7EDC9B1F02AFE600275629 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
BE7EDC9E1F02AFE600275629 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
BE7EDCA01F02AFE600275629 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BEBFCBEF1F3C81DF00F08548 /* mini-travel-sample.cblite2 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "mini-travel-sample.cblite2"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -62,7 +60,6 @@
BE7EDC881F02AFE600275629 = {
isa = PBXGroup;
children = (
BEBFCBEF1F3C81DF00F08548 /* mini-travel-sample.cblite2 */,
BE7EDC931F02AFE600275629 /* api-walkthrough */,
BE7EDC921F02AFE600275629 /* Products */,
BE7EDCA61F02B00D00275629 /* Frameworks */,
Expand Down Expand Up @@ -159,7 +156,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BEBFCBF01F3C81DF00F08548 /* mini-travel-sample.cblite2 in Resources */,
BE7EDC9F1F02AFE600275629 /* LaunchScreen.storyboard in Resources */,
BE7EDC9C1F02AFE600275629 /* Assets.xcassets in Resources */,
BE7EDC9A1F02AFE600275629 /* Main.storyboard in Resources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ class ViewController: UIViewController {

// Create index
do {
try database.createIndex(["name"], options: .fullTextIndex(language: nil, ignoreDiacritics: false))
let index = Index.ftsIndex()
.on(FTSIndexItem.expression(Expression.property("name")))
.locale(nil)
.ignoreAccents(false)
try database.createIndex(index, withName: "name-idx")
} catch let error {
print(error.localizedDescription)
}
Expand Down

0 comments on commit e446519

Please sign in to comment.