Skip to content

Commit ed8455e

Browse files
committed
feat(swift): searchWithRuleContexts
1 parent d51643f commit ed8455e

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

templates/swift/guides/search/searchRecentlyPublishedBooks.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func searchRecentlyPublishedBooks() async throws {
1515
SearchSearchParamsObject(query: "<YOUR_SEARCH_QUERY>", filters: "date_timestamp > \(dateTimestamp)")
1616
)
1717

18-
let response: SearchResponse<Hit> = {{#dynamicSnippet}}searchRecentlyPublishedBooks{{/dynamicSnippet}}
18+
let response: SearchResponse<Hit> = {{#dynamicSnippet}}searchWithSearchParams{{/dynamicSnippet}}
1919
print(response)
2020
} catch {
2121
print(error)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Foundation
2+
#if os(Linux) // For linux interop
3+
import FoundationNetworking
4+
#endif
5+
6+
import Core
7+
{{> snippets/import}}
8+
9+
func searchWithRuleContexts() async throws {
10+
do {
11+
{{> snippets/init}}
12+
13+
let platformTag = getPlatformTag()
14+
let searchParams = SearchSearchParams.searchSearchParamsObject(
15+
SearchSearchParamsObject(query: "<YOUR_SEARCH_QUERY>", ruleContexts: [platformTag])
16+
)
17+
18+
let response: SearchResponse<Hit> = {{#dynamicSnippet}}searchWithSearchParams{{/dynamicSnippet}}
19+
print(response)
20+
} catch {
21+
print(error)
22+
}
23+
}

tests/CTS/guides/search.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"requests": "$var: requests"
2626
}
2727
},
28-
"searchRecentlyPublishedBooks": {
28+
"searchWithSearchParams": {
2929
"method": "searchSingleIndex",
3030
"parameters": {
3131
"indexName": "indexName",

0 commit comments

Comments
 (0)