Skip to content

guides: snippets saveObjects/listIndices #4380

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

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ private String inferDataType(Object param, CodegenParameter spec, Map<String, Ob
spec.setIsArray(true);
// This is just to find the correct path in `handlePrimitive`, but it's not always the
// real type
// FIXME: this set voluntarily the type to string, which will fail
// We need to infer the real type
CodegenProperty baseItems = new CodegenProperty();
baseItems.dataType = "String";
spec.setItems(baseItems);
Expand Down
2 changes: 1 addition & 1 deletion templates/swift/tests/paramKey.mustache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#isRoot}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}: {{/isRoot}}{{^isRoot}}{{#useAnonymousKey}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}: {{/useAnonymousKey}}{{/isRoot}}
{{#isRoot}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}: {{/isRoot}}{{^isRoot}}{{#useAnonymousKey}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}{{#isParentFreeFormObject}}{{key}}{{/isParentFreeFormObject}}{{^isParentFreeFormObject}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}{{/isParentFreeFormObject}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}: {{/useAnonymousKey}}{{/isRoot}}
55 changes: 55 additions & 0 deletions tests/CTS/client/search/saveObjects.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,60 @@
}
}
]
},
{
"testName": "saveObjectsPlaylist",
"autoCreateClient": false,
"steps": [
{
"type": "method",
"method": "saveObjects",
"parameters": {
"indexName": "playlists",
"objects": [
{
"objectID": "1",
"user": "public",
"name": "Hot 100 Billboard Charts",
"tracks": [
"Despacito",
"Shape of You"
],
"createdAt": 1500240452
}
]
}
}
]
},
{
"testName": "saveObjectsPublicUser",
"autoCreateClient": false,
"steps": [
{
"type": "method",
"method": "saveObjects",
"parameters": {
"indexName": "playlists",
"objects": [
{
"objectID": "1",
"user": "public",
"name": "Hot 100 Billboard Charts",
"tracks": [
"Despacito",
"Shape of You"
],
"createdAt": 1500240452
}
],
"requestOptions": {
"headers": {
"X-Algolia-User-ID": "*"
}
}
}
}
]
}
]
1 change: 1 addition & 0 deletions tests/CTS/requests/search/listIndices.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"testName": "listIndices with minimal parameters",
"isSnippet": true,
"parameters": {},
"request": {
"path": "/1/indexes",
Expand Down
200 changes: 200 additions & 0 deletions tests/CTS/requests/search/setSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1327,5 +1327,205 @@
}
}
}
},
{
"testName": "searchableAttributesWithCustomRankingsAndAttributesForFaceting",
"isSnippet": true,
"parameters": {
"indexName": "theIndexName",
"indexSettings": {
"searchableAttributes": [
"brand",
"name",
"categories",
"unordered(description)"
],
"customRanking": [
"desc(popularity)"
],
"attributesForFaceting": [
"searchable(brand)",
"type",
"categories",
"price"
]
}
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"method": "PUT",
"body": {
"searchableAttributes": [
"brand",
"name",
"categories",
"unordered(description)"
],
"customRanking": [
"desc(popularity)"
],
"attributesForFaceting": [
"searchable(brand)",
"type",
"categories",
"price"
]
}
}
},
{
"testName": "searchableAttributesProductReferenceSuffixes",
"isSnippet": true,
"parameters": {
"indexName": "theIndexName",
"indexSettings": {
"searchableAttributes": [
"name",
"product_reference",
"product_reference_suffixes"
]
}
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"method": "PUT",
"body": {
"searchableAttributes": [
"name",
"product_reference",
"product_reference_suffixes"
]
}
}
},
{
"testName": "queryLanguageAndIgnorePlurals",
"isSnippet": true,
"parameters": {
"indexName": "theIndexName",
"indexSettings": {
"queryLanguages": [
"en"
],
"ignorePlurals": true
}
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"method": "PUT",
"body": {
"queryLanguages": [
"en"
],
"ignorePlurals": true
}
}
},
{
"testName": "searchableAttributesInMovies",
"isSnippet": true,
"parameters": {
"indexName": "movies",
"indexSettings": {
"searchableAttributes": [
"title_eng", "title_fr", "title_es"
]
}
},
"request": {
"path": "/1/indexes/movies/settings",
"method": "PUT",
"body": {
"searchableAttributes": [
"title_eng", "title_fr", "title_es"
]
}
}
},
{
"testName": "disablePrefixOnAttributes",
"isSnippet": true,
"parameters": {
"indexName": "theIndexName",
"indexSettings": {
"disablePrefixOnAttributes": [
"serial_number"
]
}
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"method": "PUT",
"body": {
"disablePrefixOnAttributes": [
"serial_number"
]
}
}
},
{
"testName": "disableTypoToleranceOnAttributes",
"isSnippet": true,
"parameters": {
"indexName": "theIndexName",
"indexSettings": {
"disableTypoToleranceOnAttributes": [
"serial_number"
]
}
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"method": "PUT",
"body": {
"disableTypoToleranceOnAttributes": [
"serial_number"
]
}
}
},
{
"testName": "searchableAttributesSimpleExample",
"isSnippet": true,
"parameters": {
"indexName": "theIndexName",
"indexSettings": {
"searchableAttributes": [
"serial_number"
]
}
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"method": "PUT",
"body": {
"searchableAttributes": [
"serial_number"
]
}
}
},
{
"testName": "searchableAttributesSimpleExampleAlt",
"isSnippet": true,
"parameters": {
"indexName": "theIndexName",
"indexSettings": {
"searchableAttributes": [
"serial_number",
"serial_number_suffixes"
]
}
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"method": "PUT",
"body": {
"searchableAttributes": [
"serial_number",
"serial_number_suffixes"
]
}
}
}
]
Loading