File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ Here are some examples that walk you through how to use the client: [doc/example
2020
2121| Typesense Server | typesense-php |
2222| ------------------| ----------------|
23+ | \> = v0.16.0 | \> = v4.2.0 |
2324| \> = v0.16.0 | \> = v4.1.0 |
2425| \> = v0.15.0 | \> = v4.0.0 |
2526
Original file line number Diff line number Diff line change 163163 echo "--------Delete Document------- \n" ;
164164 echo "\n" ;
165165 echo "--------Import Documents------- \n" ;
166- $ docsToImport = [];
166+ $ docsToImport = [];
167167 $ exportedDocStrsArray = explode ('\n ' , $ exportedDocStrs );
168168 foreach ($ exportedDocStrsArray as $ exportedDocStr ) {
169169 $ docsToImport [] = json_decode ($ exportedDocStr , true );
193193 print_r ($ upsertRes );
194194 echo "--------Upsert Documents------- \n" ;
195195 echo "\n" ;
196+ echo "--------Bulk Delete Documents------- \n" ;
197+ print_r ($ client ->collections ['books ' ]->documents ->delete (['filter_by ' => 'publication_year:=2008 ' ]));
198+ echo "--------Bulk Delete Documents------- \n" ;
199+ echo "\n" ;
196200 echo "--------Delete Collection------- \n" ;
197201 print_r ($ client ->collections ['books ' ]->delete ());
198202 echo "--------Delete Collection------- \n" ;
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class Documents implements \ArrayAccess
4141 public function __construct (string $ collectionName , ApiCall $ apiCall )
4242 {
4343 $ this ->collectionName = $ collectionName ;
44- $ this ->apiCall = $ apiCall ;
44+ $ this ->apiCall = $ apiCall ;
4545 }
4646
4747 /**
@@ -150,6 +150,17 @@ public function export(): string
150150 return $ this ->apiCall ->get ($ this ->endPointPath ('export ' ), [], false );
151151 }
152152
153+ /**
154+ * @param array $queryParams
155+ *
156+ * @return array
157+ * @throws TypesenseClientError|GuzzleException
158+ */
159+ public function delete (array $ queryParams = []): array
160+ {
161+ return $ this ->apiCall ->delete ($ this ->endPointPath (), true , $ queryParams );
162+ }
163+
153164 /**
154165 * @param array $searchParams
155166 *
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public function __construct(array $config)
9898 $ this ->retryIntervalSeconds = (float )($ config ['retry_interval_seconds ' ] ?? 1.0 );
9999
100100 $ this ->logLevel = $ config ->logLevel ?? Logger::WARNING ;
101- $ this ->logger = new Logger ('typesense ' );
101+ $ this ->logger = new Logger ('typesense ' );
102102 $ this ->logger ->pushHandler (new StreamHandler ('php://stdout ' , $ this ->logLevel ));
103103 }
104104
You can’t perform that action at this time.
0 commit comments