@@ -50,6 +50,8 @@ import {
5050 SeparatorTokens ,
5151 NonSeparatorTokens ,
5252 Dictionary ,
53+ ProximityPrecision ,
54+ Embedders ,
5355} from './types'
5456import { removeUndefinedFromObject } from './utils'
5557import { HttpRequests } from './http-requests'
@@ -1222,7 +1224,7 @@ class Index<T extends Record<string, any> = Record<string, any>> {
12221224 }
12231225
12241226 /**
1225- * Update the the dictionary settings. Overwrite the old settings.
1227+ * Update the dictionary settings. Overwrite the old settings.
12261228 *
12271229 * @param dictionary - Array that contains the new dictionary settings.
12281230 * @returns Promise containing an EnqueuedTask or null
@@ -1247,6 +1249,91 @@ class Index<T extends Record<string, any> = Record<string, any>> {
12471249
12481250 return task
12491251 }
1252+
1253+ ///
1254+ /// PROXIMITY PRECISION
1255+ ///
1256+
1257+ /**
1258+ * Get the proximity precision settings of a Meilisearch index.
1259+ *
1260+ * @returns Promise containing the proximity precision settings
1261+ */
1262+ async getProximityPrecision ( ) : Promise < ProximityPrecision > {
1263+ const url = `indexes/${ this . uid } /settings/proximity-precision`
1264+ return await this . httpRequest . get < ProximityPrecision > ( url )
1265+ }
1266+
1267+ /**
1268+ * Update the proximity precision settings. Overwrite the old settings.
1269+ *
1270+ * @param proximityPrecision - String that contains the new proximity
1271+ * precision settings.
1272+ * @returns Promise containing an EnqueuedTask or null
1273+ */
1274+ async updateProximityPrecision (
1275+ proximityPrecision : ProximityPrecision
1276+ ) : Promise < EnqueuedTask > {
1277+ const url = `indexes/${ this . uid } /settings/proximity-precision`
1278+ const task = await this . httpRequest . put ( url , proximityPrecision )
1279+
1280+ return new EnqueuedTask ( task )
1281+ }
1282+
1283+ /**
1284+ * Reset the proximity precision settings to its default value
1285+ *
1286+ * @returns Promise containing an EnqueuedTask
1287+ */
1288+ async resetProximityPrecision ( ) : Promise < EnqueuedTask > {
1289+ const url = `indexes/${ this . uid } /settings/proximity-precision`
1290+ const task = await this . httpRequest . delete < EnqueuedTask > ( url )
1291+
1292+ task . enqueuedAt = new Date ( task . enqueuedAt )
1293+
1294+ return task
1295+ }
1296+
1297+ ///
1298+ /// EMBEDDERS
1299+ ///
1300+
1301+ /**
1302+ * Get the embedders settings of a Meilisearch index.
1303+ *
1304+ * @returns Promise containing the embedders settings
1305+ */
1306+ async getEmbedders ( ) : Promise < Embedders > {
1307+ const url = `indexes/${ this . uid } /settings/embedders`
1308+ return await this . httpRequest . get < Embedders > ( url )
1309+ }
1310+
1311+ /**
1312+ * Update the embedders settings. Overwrite the old settings.
1313+ *
1314+ * @param embedders - Object that contains the new embedders settings.
1315+ * @returns Promise containing an EnqueuedTask or null
1316+ */
1317+ async updateEmbedders ( embedders : Embedders ) : Promise < EnqueuedTask > {
1318+ const url = `indexes/${ this . uid } /settings/embedders`
1319+ const task = await this . httpRequest . patch ( url , embedders )
1320+
1321+ return new EnqueuedTask ( task )
1322+ }
1323+
1324+ /**
1325+ * Reset the embedders settings to its default value
1326+ *
1327+ * @returns Promise containing an EnqueuedTask
1328+ */
1329+ async resetEmbedders ( ) : Promise < EnqueuedTask > {
1330+ const url = `indexes/${ this . uid } /settings/embedders`
1331+ const task = await this . httpRequest . delete < EnqueuedTask > ( url )
1332+
1333+ task . enqueuedAt = new Date ( task . enqueuedAt )
1334+
1335+ return task
1336+ }
12501337}
12511338
12521339export { Index }
0 commit comments