|
9 | 9 | try { |
10 | 10 | $client = new Client( |
11 | 11 | [ |
12 | | - 'api_key' => 'xyz', |
| 12 | + 'api_key' => 'jOr5q242ucEQHAbjMpu3bo6NEK5nKS00', |
13 | 13 | 'nodes' => [ |
14 | 14 | [ |
15 | | - 'host' => 'localhost', |
16 | | - 'port' => '8108', |
17 | | - 'protocol' => 'http', |
| 15 | + 'host' => '5wgzaxkobfc2vldtp-1.a1.typesense.net', |
| 16 | + 'port' => '443', |
| 17 | + 'protocol' => 'https', |
18 | 18 | ], |
19 | 19 | ], |
20 | 20 | 'connection_timeout_seconds' => 2, |
|
107 | 107 | echo "--------Create Document-------\n"; |
108 | 108 | echo "\n"; |
109 | 109 |
|
110 | | -// echo "--------Upsert Document-------\n"; |
111 | | -// print_r( |
112 | | -// $client->collections['books']->documents->upsert( |
113 | | -// [ |
114 | | -// 'id' => '1', |
115 | | -// 'original_publication_year' => 2008, |
116 | | -// 'authors' => [ |
117 | | -// 'Suzanne Collins', |
118 | | -// ], |
119 | | -// 'average_rating' => 4.34, |
120 | | -// 'publication_year' => 2008, |
121 | | -// 'publication_year_facet' => '2008', |
122 | | -// 'authors_facet' => [ |
123 | | -// 'Suzanne Collins', |
124 | | -// ], |
125 | | -// 'title' => 'The Hunger Games', |
126 | | -// 'image_url' => 'https://images.gr-assets.com/books/1447303603m/2767052.jpg', |
127 | | -// 'ratings_count' => 4780653, |
128 | | -// ] |
129 | | -// ) |
130 | | -// ); |
131 | | -// echo "--------Upsert Document-------\n"; |
132 | | -// echo "\n"; |
| 110 | + echo "--------Upsert Document-------\n"; |
| 111 | + print_r( |
| 112 | + $client->collections['books']->documents->upsert( |
| 113 | + [ |
| 114 | + 'id' => '1', |
| 115 | + 'original_publication_year' => 2008, |
| 116 | + 'authors' => [ |
| 117 | + 'Suzanne Collins', |
| 118 | + ], |
| 119 | + 'average_rating' => 4.6, |
| 120 | + 'publication_year' => 2008, |
| 121 | + 'publication_year_facet' => '2008', |
| 122 | + 'authors_facet' => [ |
| 123 | + 'Suzanne Collins', |
| 124 | + ], |
| 125 | + 'title' => 'The Hunger Games', |
| 126 | + 'image_url' => 'https://images.gr-assets.com/books/1447303603m/2767052.jpg', |
| 127 | + 'ratings_count' => 4780653, |
| 128 | + ] |
| 129 | + ) |
| 130 | + ); |
| 131 | + echo "--------Upsert Document-------\n"; |
| 132 | + echo "\n"; |
133 | 133 |
|
134 | 134 | echo "--------Export Documents-------\n"; |
135 | 135 | $exportedDocStrs = $client->collections['books']->documents->export(); |
|
0 commit comments