@@ -56,6 +56,7 @@ import {
56
56
SearchSimilarDocumentsParams ,
57
57
LocalizedAttributes ,
58
58
UpdateDocumentsByFunctionOptions ,
59
+ PrefixSearch ,
59
60
} from "./types" ;
60
61
import { removeUndefinedFromObject } from "./utils" ;
61
62
import { HttpRequests } from "./http-requests" ;
@@ -1457,6 +1458,80 @@ class Index<T extends Record<string, any> = Record<string, any>> {
1457
1458
1458
1459
return new EnqueuedTask ( task ) ;
1459
1460
}
1461
+
1462
+ ///
1463
+ /// FACET SEARCH SETTINGS
1464
+ ///
1465
+
1466
+ /**
1467
+ * Get the facet search settings.
1468
+ *
1469
+ * @returns Promise containing object of facet search settings
1470
+ */
1471
+ async getFacetSearch ( ) : Promise < boolean > {
1472
+ const url = `indexes/${ this . uid } /settings/facet-search` ;
1473
+ return await this . httpRequest . get < boolean > ( url ) ;
1474
+ }
1475
+
1476
+ /**
1477
+ * Update the facet search settings.
1478
+ *
1479
+ * @param facetSearch - Boolean value
1480
+ * @returns Promise containing an EnqueuedTask
1481
+ */
1482
+ async updateFacetSearch ( facetSearch : boolean ) : Promise < EnqueuedTask > {
1483
+ const url = `indexes/${ this . uid } /settings/facet-search` ;
1484
+ const task = await this . httpRequest . put ( url , facetSearch ) ;
1485
+ return new EnqueuedTask ( task ) ;
1486
+ }
1487
+
1488
+ /**
1489
+ * Reset the facet search settings.
1490
+ *
1491
+ * @returns Promise containing an EnqueuedTask
1492
+ */
1493
+ async resetFacetSearch ( ) : Promise < EnqueuedTask > {
1494
+ const url = `indexes/${ this . uid } /settings/facet-search` ;
1495
+ const task = await this . httpRequest . delete ( url ) ;
1496
+ return new EnqueuedTask ( task ) ;
1497
+ }
1498
+
1499
+ ///
1500
+ /// PREFIX SEARCH SETTINGS
1501
+ ///
1502
+
1503
+ /**
1504
+ * Get the prefix search settings.
1505
+ *
1506
+ * @returns Promise containing object of prefix search settings
1507
+ */
1508
+ async getPrefixSearch ( ) : Promise < PrefixSearch > {
1509
+ const url = `indexes/${ this . uid } /settings/prefix-search` ;
1510
+ return await this . httpRequest . get < PrefixSearch > ( url ) ;
1511
+ }
1512
+
1513
+ /**
1514
+ * Update the prefix search settings.
1515
+ *
1516
+ * @param prefixSearch - PrefixSearch value
1517
+ * @returns Promise containing an EnqueuedTask
1518
+ */
1519
+ async updatePrefixSearch ( prefixSearch : PrefixSearch ) : Promise < EnqueuedTask > {
1520
+ const url = `indexes/${ this . uid } /settings/prefix-search` ;
1521
+ const task = await this . httpRequest . put ( url , prefixSearch ) ;
1522
+ return new EnqueuedTask ( task ) ;
1523
+ }
1524
+
1525
+ /**
1526
+ * Reset the prefix search settings.
1527
+ *
1528
+ * @returns Promise containing an EnqueuedTask
1529
+ */
1530
+ async resetPrefixSearch ( ) : Promise < EnqueuedTask > {
1531
+ const url = `indexes/${ this . uid } /settings/prefix-search` ;
1532
+ const task = await this . httpRequest . delete ( url ) ;
1533
+ return new EnqueuedTask ( task ) ;
1534
+ }
1460
1535
}
1461
1536
1462
1537
export { Index } ;
0 commit comments