@@ -53,19 +53,19 @@ public function index($searchableEntities): array
5353 continue ;
5454 }
5555
56- $ indexName = $ entity ->getIndexName ();
56+ $ indexUid = $ entity ->getIndexUid ();
5757
58- if (!isset ($ data [$ indexName ])) {
59- $ data [$ indexName ] = [];
58+ if (!isset ($ data [$ indexUid ])) {
59+ $ data [$ indexUid ] = [];
6060 }
6161
62- $ data [$ indexName ][] = $ searchableArray + ['objectID ' => $ entity ->getId ()];
62+ $ data [$ indexUid ][] = $ searchableArray + ['objectID ' => $ entity ->getId ()];
6363 }
6464
6565 $ result = [];
66- foreach ($ data as $ indexName => $ objects ) {
67- $ result [$ indexName ] = $ this ->client
68- ->getOrCreateIndex ($ indexName , ['primaryKey ' => 'objectID ' ])
66+ foreach ($ data as $ indexUid => $ objects ) {
67+ $ result [$ indexUid ] = $ this ->client
68+ ->getOrCreateIndex ($ indexUid , ['primaryKey ' => 'objectID ' ])
6969 ->addDocuments ($ objects );
7070 }
7171
@@ -94,19 +94,19 @@ public function remove($searchableEntities): array
9494 if (null === $ searchableArray || 0 === count ($ searchableArray )) {
9595 continue ;
9696 }
97- $ indexName = $ entity ->getIndexName ();
97+ $ indexUid = $ entity ->getIndexName ();
9898
99- if (!isset ($ data [$ indexName ])) {
100- $ data [$ indexName ] = [];
99+ if (!isset ($ data [$ indexUid ])) {
100+ $ data [$ indexUid ] = [];
101101 }
102102
103- $ data [$ indexName ][] = $ entity ->getId ();
103+ $ data [$ indexUid ][] = $ entity ->getId ();
104104 }
105105
106106 $ result = [];
107- foreach ($ data as $ indexName => $ objects ) {
108- $ result [$ indexName ] = $ this ->client
109- ->index ($ indexName )
107+ foreach ($ data as $ indexUid => $ objects ) {
108+ $ result [$ indexUid ] = $ this ->client
109+ ->index ($ indexUid )
110110 ->deleteDocument (reset ($ objects ));
111111 }
112112
@@ -117,15 +117,15 @@ public function remove($searchableEntities): array
117117 * Clear the records of an index.
118118 * This method enables you to delete an index’s contents (records).
119119 *
120- * @param string $indexName
120+ * @param string $indexUid
121121 *
122122 * @return array
123123 *
124124 * @throws ApiException
125125 */
126- public function clear (string $ indexName ): array
126+ public function clear (string $ indexUid ): array
127127 {
128- $ index = $ this ->client ->getOrCreateIndex ($ indexName );
128+ $ index = $ this ->client ->getOrCreateIndex ($ indexUid );
129129 $ return = $ index ->deleteAllDocuments ();
130130
131131 return $ index ->getUpdateStatus ($ return ['updateId ' ]);
@@ -134,44 +134,44 @@ public function clear(string $indexName): array
134134 /**
135135 * Delete an index and it's content.
136136 *
137- * @param string $indexName
137+ * @param string $indexUid
138138 *
139139 * @return array|null
140140 */
141- public function delete (string $ indexName ): ?array
141+ public function delete (string $ indexUid ): ?array
142142 {
143- return $ this ->client ->deleteIndex ($ indexName );
143+ return $ this ->client ->deleteIndex ($ indexUid );
144144 }
145145
146146 /**
147147 * Method used for querying an index.
148148 *
149149 * @param string $query
150- * @param string $indexName
150+ * @param string $indexUid
151151 * @param array $searchParams
152152 *
153153 * @return array
154154 */
155- public function search (string $ query , string $ indexName , array $ searchParams ): array
155+ public function search (string $ query , string $ indexUid , array $ searchParams ): array
156156 {
157157 if ('' === $ query ) {
158158 $ query = null ;
159159 }
160160
161- return $ this ->client ->index ($ indexName )->rawSearch ($ query , $ searchParams );
161+ return $ this ->client ->index ($ indexUid )->rawSearch ($ query , $ searchParams );
162162 }
163163
164164 /**
165165 * Search the index and returns the number of results.
166166 *
167167 * @param string $query
168- * @param string $indexName
168+ * @param string $indexUid
169169 * @param array $requestOptions
170170 *
171171 * @return int
172172 */
173- public function count (string $ query , string $ indexName , array $ requestOptions ): int
173+ public function count (string $ query , string $ indexUid , array $ requestOptions ): int
174174 {
175- return (int ) $ this ->client ->index ($ indexName )->search ($ query , $ requestOptions )['nbHits ' ];
175+ return (int ) $ this ->client ->index ($ indexUid )->search ($ query , $ requestOptions )['nbHits ' ];
176176 }
177177}
0 commit comments