Skip to content

Commit fc4f719

Browse files
committed
update doc
1 parent d683788 commit fc4f719

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ To setup your project, follow these steps:
5757

5858

5959

60-
1. [Download and add sources](https://github.com/algolia/algoliasearch-client-swift/archive/master.zip) to your project or use [Carthage](https://github.com/Carthage/Carthage) by adding `github "algolia/algoliasearch-client-swift"` in your Cartfile or use cocoapods by adding `pod 'AlgoliaSearch-Client-Swift', '~> 1.1'` in your Podfile.
60+
1. [Download and add sources](https://github.com/algolia/algoliasearch-client-swift/archive/master.zip) to your project or use [Carthage](https://github.com/Carthage/Carthage) by adding `github "algolia/algoliasearch-client-swift"` in your Cartfile or use cocoapods by adding `pod 'AlgoliaSearch-Client-Swift', '~> 1.2'` in your Podfile.
6161
2. Add the `import AlgoliaSearch` call to your project
6262
3. Initialize the client with your ApplicationID and API-Key. You can find all of them on [your Algolia account](http://www.algolia.com/users/edit).
6363

@@ -87,25 +87,25 @@ index.addObjects(dict["objects"], block: nil)
8787
You can now search for contacts using firstname, lastname, company, etc. (even with typos):
8888
```swift
8989
// search by firstname
90-
index.search(Query(fullTextQuery: "jimmie"), block: { (JSON, error) -> Void in
90+
index.search(Query(query: "jimmie"), block: { (JSON, error) -> Void in
9191
if error == nil {
9292
println("Result: \(JSON)")
9393
}
9494
})
9595
// search a firstname with typo
96-
index.search(Query(fullTextQuery: "jimie"), block: { (JSON, error) -> Void in
96+
index.search(Query(query: "jimie"), block: { (JSON, error) -> Void in
9797
if error == nil {
9898
println("Result: \(JSON)")
9999
}
100100
})
101101
// search for a company
102-
index.search(Query(fullTextQuery: "california paint"), block: { (JSON, error) -> Void in
102+
index.search(Query(query: "california paint"), block: { (JSON, error) -> Void in
103103
if error == nil {
104104
println("Result: \(JSON)")
105105
}
106106
})
107107
// search for a firstname & company
108-
index.search(Query(fullTextQuery: "jimmie paint"), block: { (JSON, error) -> Void in
108+
index.search(Query(query: "jimmie paint"), block: { (JSON, error) -> Void in
109109
if error == nil {
110110
println("Result: \(JSON)")
111111
}
@@ -136,13 +136,13 @@ index.setSettings(settings, block: { (JSON, error) -> Void in
136136

137137
Since the engine is designed to suggest results as you type, you'll generally search by prefix. In this case the order of attributes is very important to decide which hit is the best:
138138
```swift
139-
index.search(Query(fullTextQuery: "or"), block: { (JSON, error) -> Void in
139+
index.search(Query(query: "or"), block: { (JSON, error) -> Void in
140140
if error == nil {
141141
println("Result: \(JSON)")
142142
}
143143
})
144144

145-
index.search(Query(fullTextQuery: "jim"), block: { (JSON, error) -> Void in
145+
index.search(Query(query: "jim"), block: { (JSON, error) -> Void in
146146
if error == nil {
147147
println("Result: \(JSON)")
148148
}
@@ -230,9 +230,9 @@ Example on how to replace all attributes of an existing object:
230230

231231
```swift
232232
let newObject = [
233-
"firstname": "Jimmie",
234-
"lastname": "Barninger",
235-
"city": "New York"
233+
"firstname": "Jimmie",
234+
"lastname": "Barninger",
235+
"city": "New York",
236236
"objectID": "myID"
237237
]
238238
index.saveObject(newObject, block: nil)
@@ -269,7 +269,7 @@ Example to remove a tag:
269269

270270
```swift
271271
let operation = [
272-
"value": "MyTag".
272+
"value": "MyTag",
273273
"_operation": "Remove"
274274
]
275275
let partialObject = ["_tags": operation]
@@ -398,13 +398,13 @@ You can also use a string array encoding (for example `numericFilters: ["price>1
398398
399399
```swift
400400
let index = client.getIndex("contacts")
401-
index.search(Query(fullTextQuery: "s"), block: { (JSON, error) -> Void in
401+
index.search(Query(query: "s"), block: { (JSON, error) -> Void in
402402
if error == nil {
403403
println("Result: \(JSON)")
404404
}
405405
})
406406
407-
let query = Query(fullTextQuery: "s")
407+
let query = Query(query: "s")
408408
query.attributesToRetrieve = ["firstname", "lastname"]
409409
query.hitsPerPage = 50
410410
index.search(query, block: { (JSON, error) -> Void in
@@ -471,6 +471,8 @@ client.multipleQueries(queries, block: { (JSON, error) -> Void in
471471
})
472472
```
473473
474+
The resulting JSON answer contains a ```results``` array storing the underlying queries answers. The answers order is the same than the requests order.
475+
474476
You can specify a strategy to optimize your multiple queries:
475477
- **none**: Execute the sequence of queries until the end.
476478
- **stopIfEnoughMatches**: Execute the sequence of queries until the number of hits is reached by the sum of hits.

0 commit comments

Comments
 (0)