@@ -510,6 +510,30 @@ public function search($query, $args = null)
510
510
);
511
511
}
512
512
513
+ /**
514
+ * Perform a search inside facets.
515
+ *
516
+ * @param $facetName
517
+ * @param $facetQuery
518
+ * @param array $query
519
+ * @return mixed
520
+ */
521
+ public function searchFacet ($ facetName , $ facetQuery , $ query = array ())
522
+ {
523
+ $ query ['facetQuery ' ] = $ facetQuery ;
524
+
525
+ return $ this ->client ->request (
526
+ $ this ->context ,
527
+ 'POST ' ,
528
+ '/1/indexes/ ' .$ this ->urlIndexName .'/facets/ ' .$ facetName .'/query ' ,
529
+ array (),
530
+ array ('params ' => $ this ->client ->buildQuery ($ query )),
531
+ $ this ->context ->readHostsArray ,
532
+ $ this ->context ->connectTimeout ,
533
+ $ this ->context ->searchTimeout
534
+ );
535
+ }
536
+
513
537
/**
514
538
* Perform a search with disjunctive facets generating as many queries as number of disjunctive facets.
515
539
*
@@ -741,7 +765,7 @@ public function clearIndex()
741
765
* - attributesToSnippet**: (array of strings) default list of attributes to snippet alongside the
742
766
* number of words to return (syntax is attributeName:nbWords). By default no snippet is computed.
743
767
* If set to null, no snippet is computed.
744
- * - attributesToIndex: (array of strings) the list of fields you want to index.
768
+ * - searchableAttributes (formerly named attributesToIndex) : (array of strings) the list of fields you want to index.
745
769
* If set to null, all textual and numerical attributes of your objects are indexed, but you
746
770
* should update it to get optimal results. This parameter has two important uses:
747
771
* - Limit the attributes to index: For example if you store a binary image in base64, you want to
@@ -750,7 +774,7 @@ public function clearIndex()
750
774
* attributes at the beginning of the list will be considered more important than matches in
751
775
* attributes further down the list. In one attribute, matching text at the beginning of the
752
776
* attribute will be considered more important than text after, you can disable this behavior if
753
- * you add your attribute inside `unordered(AttributeName)`, for example attributesToIndex :
777
+ * you add your attribute inside `unordered(AttributeName)`, for example searchableAttributes :
754
778
* ["title", "unordered(text)"].
755
779
* - attributesForFaceting: (array of strings) The list of fields you want to use for faceting.
756
780
* All strings in the attribute selected for faceting are extracted and added as a facet. If set
@@ -765,7 +789,7 @@ public function clearIndex()
765
789
* - typo: sort according to number of typos,
766
790
* - geo: sort according to decreassing distance when performing a geo-location based search,
767
791
* - proximity: sort according to the proximity of query words in hits,
768
- * - attribute: sort according to the order of attributes defined by attributesToIndex ,
792
+ * - attribute: sort according to the order of attributes defined by searchableAttributes ,
769
793
* - exact:
770
794
* - if the user query contains one word: sort objects having an attribute that is exactly the
771
795
* query word before others. For example if you search for the "V" TV show, you want to find it
@@ -789,16 +813,16 @@ public function clearIndex()
789
813
* - optionalWords: (array of strings) Specify a list of words that should be considered as
790
814
* optional when found in the query.
791
815
*
792
- * @param bool $forwardToSlaves
816
+ * @param bool $forwardToReplicas
793
817
* @return mixed
794
818
* @throws AlgoliaException
795
819
*/
796
- public function setSettings ($ settings , $ forwardToSlaves = false )
820
+ public function setSettings ($ settings , $ forwardToReplicas = false )
797
821
{
798
822
$ url = '/1/indexes/ ' .$ this ->urlIndexName .'/settings ' ;
799
823
800
- if ($ forwardToSlaves ) {
801
- $ url = $ url .'?forwardToSlaves =true ' ;
824
+ if ($ forwardToReplicas ) {
825
+ $ url = $ url .'?forwardToReplicas =true ' ;
802
826
}
803
827
804
828
return $ this ->client ->request (
@@ -1171,18 +1195,18 @@ public function getSynonym($objectID)
1171
1195
1172
1196
/**
1173
1197
* @param $objectID
1174
- * @param $forwardToSlaves
1198
+ * @param $forwardToReplicas
1175
1199
*
1176
1200
* @return mixed
1177
1201
*
1178
1202
* @throws AlgoliaException
1179
1203
*/
1180
- public function deleteSynonym ($ objectID , $ forwardToSlaves = false )
1204
+ public function deleteSynonym ($ objectID , $ forwardToReplicas = false )
1181
1205
{
1182
1206
return $ this ->client ->request (
1183
1207
$ this ->context ,
1184
1208
'DELETE ' ,
1185
- '/1/indexes/ ' .$ this ->urlIndexName .'/synonyms/ ' .urlencode ($ objectID ).'?forwardToSlaves = ' .($ forwardToSlaves ? 'true ' : 'false ' ),
1209
+ '/1/indexes/ ' .$ this ->urlIndexName .'/synonyms/ ' .urlencode ($ objectID ).'?forwardToReplicas = ' .($ forwardToReplicas ? 'true ' : 'false ' ),
1186
1210
null ,
1187
1211
null ,
1188
1212
$ this ->context ->writeHostsArray ,
@@ -1192,18 +1216,18 @@ public function deleteSynonym($objectID, $forwardToSlaves = false)
1192
1216
}
1193
1217
1194
1218
/**
1195
- * @param bool $forwardToSlaves
1219
+ * @param bool $forwardToReplicas
1196
1220
*
1197
1221
* @return mixed
1198
1222
*
1199
1223
* @throws AlgoliaException
1200
1224
*/
1201
- public function clearSynonyms ($ forwardToSlaves = false )
1225
+ public function clearSynonyms ($ forwardToReplicas = false )
1202
1226
{
1203
1227
return $ this ->client ->request (
1204
1228
$ this ->context ,
1205
1229
'POST ' ,
1206
- '/1/indexes/ ' .$ this ->urlIndexName .'/synonyms/clear?forwardToSlaves = ' .($ forwardToSlaves ? 'true ' : 'false ' ),
1230
+ '/1/indexes/ ' .$ this ->urlIndexName .'/synonyms/clear?forwardToReplicas = ' .($ forwardToReplicas ? 'true ' : 'false ' ),
1207
1231
null ,
1208
1232
null ,
1209
1233
$ this ->context ->writeHostsArray ,
@@ -1214,20 +1238,20 @@ public function clearSynonyms($forwardToSlaves = false)
1214
1238
1215
1239
/**
1216
1240
* @param $objects
1217
- * @param bool $forwardToSlaves
1241
+ * @param bool $forwardToReplicas
1218
1242
* @param bool $replaceExistingSynonyms
1219
1243
*
1220
1244
* @return mixed
1221
1245
*
1222
1246
* @throws AlgoliaException
1223
1247
*/
1224
- public function batchSynonyms ($ objects , $ forwardToSlaves = false , $ replaceExistingSynonyms = false )
1248
+ public function batchSynonyms ($ objects , $ forwardToReplicas = false , $ replaceExistingSynonyms = false )
1225
1249
{
1226
1250
return $ this ->client ->request (
1227
1251
$ this ->context ,
1228
1252
'POST ' ,
1229
1253
'/1/indexes/ ' .$ this ->urlIndexName .'/synonyms/batch?replaceExistingSynonyms= ' .($ replaceExistingSynonyms ? 'true ' : 'false ' )
1230
- .'&forwardToSlaves = ' .($ forwardToSlaves ? 'true ' : 'false ' ),
1254
+ .'&forwardToReplicas = ' .($ forwardToReplicas ? 'true ' : 'false ' ),
1231
1255
null ,
1232
1256
$ objects ,
1233
1257
$ this ->context ->writeHostsArray ,
@@ -1239,18 +1263,18 @@ public function batchSynonyms($objects, $forwardToSlaves = false, $replaceExisti
1239
1263
/**
1240
1264
* @param $objectID
1241
1265
* @param $content
1242
- * @param bool $forwardToSlaves
1266
+ * @param bool $forwardToReplicas
1243
1267
*
1244
1268
* @return mixed
1245
1269
*
1246
1270
* @throws AlgoliaException
1247
1271
*/
1248
- public function saveSynonym ($ objectID , $ content , $ forwardToSlaves = false )
1272
+ public function saveSynonym ($ objectID , $ content , $ forwardToReplicas = false )
1249
1273
{
1250
1274
return $ this ->client ->request (
1251
1275
$ this ->context ,
1252
1276
'PUT ' ,
1253
- '/1/indexes/ ' .$ this ->urlIndexName .'/synonyms/ ' .urlencode ($ objectID ).'?forwardToSlaves = ' .($ forwardToSlaves ? 'true ' : 'false ' ),
1277
+ '/1/indexes/ ' .$ this ->urlIndexName .'/synonyms/ ' .urlencode ($ objectID ).'?forwardToReplicas = ' .($ forwardToReplicas ? 'true ' : 'false ' ),
1254
1278
null ,
1255
1279
$ content ,
1256
1280
$ this ->context ->writeHostsArray ,
0 commit comments