@algolia/recommend 5.0.0-alpha.2 → 5.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/builds/browser.d.ts +2 -2
  2. package/dist/builds/browser.d.ts.map +1 -1
  3. package/dist/builds/node.d.ts +2 -2
  4. package/dist/builds/node.d.ts.map +1 -1
  5. package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -1
  6. package/dist/model/alternativesAsExact.d.ts.map +1 -1
  7. package/dist/model/aroundRadius.d.ts.map +1 -1
  8. package/dist/model/aroundRadiusAll.d.ts.map +1 -1
  9. package/dist/model/baseRecommendRequest.d.ts.map +1 -1
  10. package/dist/model/baseRecommendationRequest.d.ts.map +1 -1
  11. package/dist/model/baseSearchParams.d.ts.map +1 -1
  12. package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -1
  13. package/dist/model/baseSearchResponse.d.ts +1 -1
  14. package/dist/model/baseSearchResponse.d.ts.map +1 -1
  15. package/dist/model/baseTrendingRequest.d.ts.map +1 -1
  16. package/dist/model/clientMethodProps.d.ts.map +1 -1
  17. package/dist/model/distinct.d.ts +5 -0
  18. package/dist/model/distinct.d.ts.map +1 -0
  19. package/dist/model/errorBase.d.ts.map +1 -1
  20. package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -1
  21. package/dist/model/facetFilters.d.ts.map +1 -1
  22. package/dist/model/facetOrdering.d.ts.map +1 -1
  23. package/dist/model/facets.d.ts.map +1 -1
  24. package/dist/model/facetsStats.d.ts.map +1 -1
  25. package/dist/model/getRecommendationsParams.d.ts.map +1 -1
  26. package/dist/model/getRecommendationsResponse.d.ts.map +1 -1
  27. package/dist/model/highlightResult.d.ts.map +1 -1
  28. package/dist/model/highlightResultOption.d.ts.map +1 -1
  29. package/dist/model/ignorePlurals.d.ts.map +1 -1
  30. package/dist/model/index.d.ts +1 -0
  31. package/dist/model/index.d.ts.map +1 -1
  32. package/dist/model/indexSettingsAsSearchParams.d.ts +4 -6
  33. package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  34. package/dist/model/matchLevel.d.ts.map +1 -1
  35. package/dist/model/matchedGeoLocation.d.ts.map +1 -1
  36. package/dist/model/mixedSearchFilters.d.ts.map +1 -1
  37. package/dist/model/numericFilters.d.ts.map +1 -1
  38. package/dist/model/optionalFilters.d.ts.map +1 -1
  39. package/dist/model/personalization.d.ts.map +1 -1
  40. package/dist/model/queryType.d.ts.map +1 -1
  41. package/dist/model/rankingInfo.d.ts.map +1 -1
  42. package/dist/model/reRankingApplyFilter.d.ts.map +1 -1
  43. package/dist/model/recommendHit.d.ts.map +1 -1
  44. package/dist/model/recommendHits.d.ts.map +1 -1
  45. package/dist/model/recommendationModels.d.ts.map +1 -1
  46. package/dist/model/recommendationRequest.d.ts.map +1 -1
  47. package/dist/model/recommendationsRequest.d.ts.map +1 -1
  48. package/dist/model/recommendationsResponse.d.ts.map +1 -1
  49. package/dist/model/removeStopWords.d.ts.map +1 -1
  50. package/dist/model/removeWordsIfNoResults.d.ts.map +1 -1
  51. package/dist/model/renderingContent.d.ts.map +1 -1
  52. package/dist/model/searchParamsObject.d.ts.map +1 -1
  53. package/dist/model/searchParamsQuery.d.ts.map +1 -1
  54. package/dist/model/snippetResult.d.ts.map +1 -1
  55. package/dist/model/snippetResultOption.d.ts.map +1 -1
  56. package/dist/model/sortRemainingBy.d.ts.map +1 -1
  57. package/dist/model/tagFilters.d.ts.map +1 -1
  58. package/dist/model/trendingModels.d.ts.map +1 -1
  59. package/dist/model/trendingRequest.d.ts.map +1 -1
  60. package/dist/model/typoTolerance.d.ts.map +1 -1
  61. package/dist/model/typoToleranceEnum.d.ts.map +1 -1
  62. package/dist/model/value.d.ts.map +1 -1
  63. package/dist/recommend.cjs.js +14 -1
  64. package/dist/recommend.esm.browser.js +15 -2
  65. package/dist/recommend.esm.node.js +14 -1
  66. package/dist/recommend.umd.js +2 -2
  67. package/dist/src/recommendClient.d.ts +9 -1
  68. package/dist/src/recommendClient.d.ts.map +1 -1
  69. package/model/baseRecommendRequest.ts +4 -0
  70. package/model/baseRecommendationRequest.ts +1 -0
  71. package/model/baseSearchParamsWithoutQuery.ts +32 -0
  72. package/model/baseSearchResponse.ts +25 -1
  73. package/model/baseTrendingRequest.ts +2 -0
  74. package/model/distinct.ts +6 -0
  75. package/model/facetOrdering.ts +1 -0
  76. package/model/facetsStats.ts +3 -0
  77. package/model/highlightResultOption.ts +3 -0
  78. package/model/index.ts +1 -0
  79. package/model/indexSettingsAsSearchParams.ts +45 -6
  80. package/model/matchedGeoLocation.ts +2 -0
  81. package/model/personalization.ts +2 -0
  82. package/model/rankingInfo.ts +12 -0
  83. package/model/recommendHit.ts +5 -0
  84. package/model/snippetResultOption.ts +1 -0
  85. package/model/value.ts +1 -0
  86. package/package.json +31 -13
@@ -1,2 +1,2 @@
1
- /*! recommend.umd.js | 5.0.0-alpha.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend"]={})}(this,(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function s(){return JSON.parse(a().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),a=s()[r];return Promise.all([a||t(),void 0!==a])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=s();return n[JSON.stringify(e)]=t,a().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=s();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function a(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,s,n={miss:()=>Promise.resolve()})=>r.get(e,s,n).catch((()=>a({caches:t}).get(e,s,n))),set:(e,s)=>r.set(e,s).catch((()=>a({caches:t}).set(e,s))),delete:e=>r.delete(e).catch((()=>a({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>a({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,a,s={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=a();return o.then((e=>s.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const n=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>n},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=n}}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class p extends u{constructor(e,t,r){super(e,r,"ApiError"),i(this,"status",void 0),this.status=t}}class d extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}function h(e,t,r){const a=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${t(e[r])?JSON.stringify(e[r]):e[r]}`)).join("&")}(r);let s=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return a.length&&(s+=`?${a}`),s}function m(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:s,timeouts:n,requester:i,requestsCache:c,responsesCache:u}){async function f(c,u,f=!0){const g=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,u),O=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},s={};return Object.keys(a).forEach((e=>{const t=a[e];s[e.toLowerCase()]=t})),s}(r,c.headers,u.headers),b="GET"===c.method?{...c.data,...u.data}:{},P={"x-algolia-agent":s.value,...a,...c.queryParameters,...b};if(u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?P[e]=u.queryParameters[e].toString():P[e]=u.queryParameters[e];let v=0;const w=async(e,r)=>{const a=e.pop();if(void 0===a)throw new l(function(e){return e.map((e=>m(e)))}(g));let s=u.timeout;void 0===s&&(s=f?n.read:n.write);const b={data:y,headers:O,method:c.method,url:h(a,c.path,P),connectTimeout:r(v,n.connect),responseTimeout:r(v,s)},j=t=>{const r={request:b,response:t,host:a,triesLeft:e.length};return g.push(r),r},q=await i.send(b);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(q)){const s=j(q);return q.isTimedOut&&v++,console.log("Retryable failure",m(s)),await t.set(a,o(a,q.isTimedOut?"timed out":"down")),w(e,r)}if(function({status:e}){return 2==~~(e/100)}(q))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(q);throw j(q),function({content:e,status:t},r){let a=e;try{a=JSON.parse(e).message}catch(e){}return new p(a,t,r)}(q,g)},j=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),q=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),a=r.filter((e=>e.isUp())),s=r.filter((e=>e.isTimedOut())),n=[...a,...s];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===s.length&&0===e?1:s.length+3+e)*t}}(j);return w([...q.hosts].reverse(),q.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:s,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const s=e.useReadTransporter||"GET"===e.method;if(!s)return f(e,t,s);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return u.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(o,e)})},requestsCache:c,responsesCache:u}}function g({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}function y(e,t){if(null==e)return{};var r,a,s=function(e,t){if(null==e)return{};var r,a,s={},n=Object.keys(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var O=["appId","apiKey","authMode","algoliaAgents"];function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function P(e){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?b(Object(a),!0).forEach((function(r){t(e,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):b(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var v="5.0.0-alpha.2";function w(e){return[{url:"".concat(e,"-dsn.algolia.net"),accept:"read",protocol:"https"},{url:"".concat(e,".algolia.net"),accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1)),s=e[r];t[r]=e[a],t[a]=s}return t}([{url:"".concat(e,"-1.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-2.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-3.algolianet.com"),accept:"readWrite",protocol:"https"}]))}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}e.apiClientVersion=v,e.recommendClient=function(e,n,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!n||"string"!=typeof n)throw new Error("`apiKey` is missing.");return function(e){var t=e.appId,r=e.apiKey,a=e.authMode,s=e.algoliaAgents,n=y(e,O),o=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(t,r,a),i=f(P(P({hosts:w(t)},n),{},{algoliaAgent:g({algoliaAgents:s,client:"Recommend",version:v}),baseHeaders:P(P({"content-type":"text/plain"},o.headers()),n.baseHeaders),baseQueryParameters:P(P({},o.queryParameters()),n.baseQueryParameters)}));return{transporter:i,get _ua(){return i.algoliaAgent.value},addAlgoliaAgent:function(e,t){i.algoliaAgent.add({segment:e,version:t})},del:function(e,t){var r=e.path,a=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `del`.");var s={method:"DELETE",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{}};return i.request(s,t)},get:function(e,t){var r=e.path,a=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `get`.");var s={method:"GET",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{}};return i.request(s,t)},getRecommendations:function(e,t){if(!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");var r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return i.request(r,t)},post:function(e,t){var r=e.path,a=e.parameters,s=e.body;if(!r)throw new Error("Parameter `path` is required when calling `post`.");var n={method:"POST",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{},data:s||{}};return i.request(n,t)},put:function(e,t){var r=e.path,a=e.parameters,s=e.body;if(!r)throw new Error("Parameter `path` is required when calling `put`.");var n={method:"PUT",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{},data:s||{}};return i.request(n,t)}}}(function(e){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?j(Object(a),!0).forEach((function(r){t(e,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):j(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({appId:e,apiKey:n,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),s=a(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:a({caches:[r({key:"".concat(v,"-").concat(e)}),s()]})},o))}}));
1
+ /*! recommend.umd.js | 5.0.0-alpha.20 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(o)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),n(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),n(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class l extends c{constructor(e,t,r){super(e,r,"ApiError"),n(this,"status",void 0),this.status=t}}class d extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}function h(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function m(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function p({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:p}){async function g(c,p,g=!0){const f=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,p),P=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,p.headers),w="GET"===c.method?{...c.data,...p.data}:{},q={"x-algolia-agent":a.value,...s,...c.queryParameters,...w};if(p&&p.queryParameters)for(const e of Object.keys(p.queryParameters))p.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(p.queryParameters[e])?q[e]=p.queryParameters[e].toString():q[e]=p.queryParameters[e];let v=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>m(e)))}(f));let a=p.timeout;void 0===a&&(a=g?n.read:n.write);const w={data:y,headers:P,method:c.method,url:h(s,c.path,q),connectTimeout:r(v,n.connect),responseTimeout:r(v,a)},O=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return f.push(r),r},T=await i.send(w);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(T)){const a=O(T);return T.isTimedOut&&v++,console.log("Retryable failure",m(a)),await t.set(s,o(s,T.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(T))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(T);throw O(T),function({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(e){}return new l(s,t,r)}(T,f)},O=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),T=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(O);return b([...T.hosts].reverse(),T.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const o=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return p.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>p.set(n,e)})},requestsCache:c,responsesCache:p}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const f="5.0.0-alpha.20";function y(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const s=Math.floor(Math.random()*(r+1)),a=e[r];t[r]=e[s],t[s]=a}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}e.apiClientVersion=f,e.recommendClient=function(e,a,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,...a}){const o=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),n=p({hosts:y(e),...a,algoliaAgent:g({algoliaAgents:s,client:"Recommend",version:f}),baseHeaders:{"content-type":"text/plain",...o.headers(),...a.baseHeaders},baseQueryParameters:{...o.queryParameters(),...a.baseQueryParameters}});return{transporter:n,appId:e,clearCache:()=>Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((()=>{})),get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(e,t){n.algoliaAgent.add({segment:e,version:t})},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(s,r)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return n.request(s,r)},getRecommendations(e,t){if(!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return n.request(r,t)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return n.request(a,s)}}}({appId:e,apiKey:a,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`5.0.0-alpha.20-${e}`}),s()]}),...o})}}));
@@ -2,9 +2,17 @@ import type { CreateClientOptions, RequestOptions } from '@algolia/client-common
2
2
  import type { DelProps, GetProps, PostProps, PutProps } from '../model/clientMethodProps';
3
3
  import type { GetRecommendationsParams } from '../model/getRecommendationsParams';
4
4
  import type { GetRecommendationsResponse } from '../model/getRecommendationsResponse';
5
- export declare const apiClientVersion = "5.0.0-alpha.2";
5
+ export declare const apiClientVersion = "5.0.0-alpha.20";
6
6
  export declare function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
7
7
  transporter: import("@algolia/client-common").Transporter;
8
+ /**
9
+ * The `appId` currently in use.
10
+ */
11
+ appId: string;
12
+ /**
13
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
14
+ */
15
+ clearCache(): Promise<void>;
8
16
  /**
9
17
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
10
18
  */
@@ -1 +1 @@
1
- {"version":3,"file":"recommendClient.d.ts","sourceRoot":"","sources":["../../../../packages/recommend/src/recommendClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,mBAAmB,EAInB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAsChD,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,QAAQ,EACR,aAAa,EACb,GAAG,OAAO,EACX,EAAE,mBAAmB;;IAuBlB;;OAEG;;IAIH;;;;;OAKG;6BACsB,MAAM,YAAY,MAAM,GAAG,IAAI;IAGxD;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;;OAMG;iDAEyB,wBAAwB,mBACjC,cAAc,GAC9B,QAAQ,0BAA0B,CAAC;IA8BtC;;;;;;;;;OASG;qCAE2B,SAAS,mBACpB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAoB/B;;;;;;;;;OASG;oCAE2B,QAAQ,mBACnB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;EAoBlC;AAED;;GAEG;AACH,oBAAY,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"recommendClient.d.ts","sourceRoot":"","sources":["../../src/recommendClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,mBAAmB,EAInB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAsCjD,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,QAAQ,EACR,aAAa,EACb,GAAG,OAAO,EACX,EAAE,mBAAmB;;IAwBlB;;OAEG;;IAGH;;OAEG;kBACW,QAAQ,IAAI,CAAC;IAO3B;;OAEG;;IAKH;;;;;OAKG;6BACsB,MAAM,YAAY,MAAM,GAAG,IAAI;IAIxD;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;;OAMG;iDAEyB,wBAAwB,mBACjC,cAAc,GAC9B,QAAQ,0BAA0B,CAAC;IA8BtC;;;;;;;;;OASG;qCAE2B,SAAS,mBACpB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAoB/B;;;;;;;;;OASG;oCAE2B,QAAQ,mBACnB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;EAoBlC;AAED;;GAEG;AACH,oBAAY,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -7,14 +7,18 @@ export type BaseRecommendRequest = {
7
7
  * The Algolia index name.
8
8
  */
9
9
  indexName: string;
10
+
10
11
  /**
11
12
  * The threshold to use when filtering recommendations by their score.
12
13
  */
13
14
  threshold: number;
15
+
14
16
  /**
15
17
  * The max number of recommendations to retrieve. If it\'s set to 0, all the recommendations of the objectID may be returned.
16
18
  */
17
19
  maxRecommendations?: number;
20
+
18
21
  queryParameters?: SearchParamsObject;
22
+
19
23
  fallbackParameters?: SearchParamsObject;
20
24
  };
@@ -4,6 +4,7 @@ import type { RecommendationModels } from './recommendationModels';
4
4
 
5
5
  export type BaseRecommendationRequest = {
6
6
  model: RecommendationModels;
7
+
7
8
  /**
8
9
  * Unique identifier of the object.
9
10
  */
@@ -12,114 +12,146 @@ export type BaseSearchParamsWithoutQuery = {
12
12
  * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.
13
13
  */
14
14
  similarQuery?: string;
15
+
15
16
  /**
16
17
  * Filter the query with numeric, facet and/or tag filters.
17
18
  */
18
19
  filters?: string;
20
+
19
21
  facetFilters?: FacetFilters;
22
+
20
23
  optionalFilters?: OptionalFilters;
24
+
21
25
  numericFilters?: NumericFilters;
26
+
22
27
  tagFilters?: TagFilters;
28
+
23
29
  /**
24
30
  * Determines how to calculate the total score for filtering.
25
31
  */
26
32
  sumOrFiltersScores?: boolean;
33
+
27
34
  /**
28
35
  * Retrieve facets and their facet values.
29
36
  */
30
37
  facets?: string[];
38
+
31
39
  /**
32
40
  * Maximum number of facet values to return for each facet during a regular search.
33
41
  */
34
42
  maxValuesPerFacet?: number;
43
+
35
44
  /**
36
45
  * Force faceting to be applied after de-duplication (via the Distinct setting).
37
46
  */
38
47
  facetingAfterDistinct?: boolean;
48
+
39
49
  /**
40
50
  * Controls how facet values are fetched.
41
51
  */
42
52
  sortFacetValuesBy?: string;
53
+
43
54
  /**
44
55
  * Specify the page to retrieve.
45
56
  */
46
57
  page?: number;
58
+
47
59
  /**
48
60
  * Specify the offset of the first hit to return.
49
61
  */
50
62
  offset?: number;
63
+
51
64
  /**
52
65
  * Set the number of hits to retrieve (used only with offset).
53
66
  */
54
67
  length?: number;
68
+
55
69
  /**
56
70
  * Search for entries around a central geolocation, enabling a geo search within a circular area.
57
71
  */
58
72
  aroundLatLng?: string;
73
+
59
74
  /**
60
75
  * Search for entries around a given location automatically computed from the requester\'s IP address.
61
76
  */
62
77
  aroundLatLngViaIP?: boolean;
78
+
63
79
  aroundRadius?: AroundRadius;
80
+
64
81
  /**
65
82
  * Precision of geo search (in meters), to add grouping by geo location to the ranking formula.
66
83
  */
67
84
  aroundPrecision?: number;
85
+
68
86
  /**
69
87
  * Minimum radius (in meters) used for a geo search when aroundRadius is not set.
70
88
  */
71
89
  minimumAroundRadius?: number;
90
+
72
91
  /**
73
92
  * Search inside a rectangular area (in geo coordinates).
74
93
  */
75
94
  insideBoundingBox?: number[];
95
+
76
96
  /**
77
97
  * Search inside a polygon (in geo coordinates).
78
98
  */
79
99
  insidePolygon?: number[];
100
+
80
101
  /**
81
102
  * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.
82
103
  */
83
104
  naturalLanguages?: string[];
105
+
84
106
  /**
85
107
  * Enables contextual rules.
86
108
  */
87
109
  ruleContexts?: string[];
110
+
88
111
  /**
89
112
  * Define the impact of the Personalization feature.
90
113
  */
91
114
  personalizationImpact?: number;
115
+
92
116
  /**
93
117
  * Associates a certain user token with the current search.
94
118
  */
95
119
  userToken?: string;
120
+
96
121
  /**
97
122
  * Retrieve detailed ranking information.
98
123
  */
99
124
  getRankingInfo?: boolean;
125
+
100
126
  /**
101
127
  * Enable the Click Analytics feature.
102
128
  */
103
129
  clickAnalytics?: boolean;
130
+
104
131
  /**
105
132
  * Whether the current query will be taken into account in the Analytics.
106
133
  */
107
134
  analytics?: boolean;
135
+
108
136
  /**
109
137
  * List of tags to apply to the query for analytics purposes.
110
138
  */
111
139
  analyticsTags?: string[];
140
+
112
141
  /**
113
142
  * Whether to include or exclude a query from the processing-time percentile computation.
114
143
  */
115
144
  percentileComputation?: boolean;
145
+
116
146
  /**
117
147
  * Whether this search should participate in running AB tests.
118
148
  */
119
149
  enableABTest?: boolean;
150
+
120
151
  /**
121
152
  * Whether this search should use AI Re-Ranking.
122
153
  */
123
154
  enableReRanking?: boolean;
155
+
124
156
  reRankingApplyFilter?: ReRankingApplyFilter | null;
125
157
  };
@@ -8,97 +8,121 @@ export type BaseSearchResponse = {
8
8
  * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.
9
9
  */
10
10
  abTestID?: number;
11
+
11
12
  /**
12
13
  * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used (starting at 1).
13
14
  */
14
15
  abTestVariantID?: number;
16
+
15
17
  /**
16
18
  * The computed geo location.
17
19
  */
18
20
  aroundLatLng?: string;
21
+
19
22
  /**
20
23
  * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.
21
24
  */
22
25
  automaticRadius?: string;
26
+
23
27
  /**
24
28
  * Whether the facet count is exhaustive or approximate.
25
29
  */
26
30
  exhaustiveFacetsCount?: boolean;
31
+
27
32
  /**
28
33
  * Indicate if the nbHits count was exhaustive or approximate.
29
34
  */
30
35
  exhaustiveNbHits: boolean;
36
+
31
37
  /**
32
38
  * Indicate if the typo-tolerance search was exhaustive or approximate (only included when typo-tolerance is enabled).
33
39
  */
34
- exhaustiveTypo: boolean;
40
+ exhaustiveTypo?: boolean;
41
+
35
42
  /**
36
43
  * A mapping of each facet name to the corresponding facet counts.
37
44
  */
38
45
  facets?: Record<string, Record<string, number>>;
46
+
39
47
  /**
40
48
  * Statistics for numerical facets.
41
49
  */
42
50
  facets_stats?: Record<string, FacetsStats>;
51
+
43
52
  /**
44
53
  * Set the number of hits per page.
45
54
  */
46
55
  hitsPerPage: number;
56
+
47
57
  /**
48
58
  * Index name used for the query.
49
59
  */
50
60
  index?: string;
61
+
51
62
  /**
52
63
  * Index name used for the query. In the case of an A/B test, the targeted index isn\'t always the index used by the query.
53
64
  */
54
65
  indexUsed?: string;
66
+
55
67
  /**
56
68
  * Used to return warnings about the query.
57
69
  */
58
70
  message?: string;
71
+
59
72
  /**
60
73
  * Number of hits that the search query matched.
61
74
  */
62
75
  nbHits: number;
76
+
63
77
  /**
64
78
  * Number of pages available for the current query.
65
79
  */
66
80
  nbPages: number;
81
+
67
82
  /**
68
83
  * The number of hits selected and sorted by the relevant sort algorithm.
69
84
  */
70
85
  nbSortedHits?: number;
86
+
71
87
  /**
72
88
  * Specify the page to retrieve.
73
89
  */
74
90
  page: number;
91
+
75
92
  /**
76
93
  * A url-encoded string of all search parameters.
77
94
  */
78
95
  params: string;
96
+
79
97
  /**
80
98
  * The query string that will be searched, after normalization.
81
99
  */
82
100
  parsedQuery?: string;
101
+
83
102
  /**
84
103
  * Time the server took to process the request, in milliseconds.
85
104
  */
86
105
  processingTimeMS: number;
106
+
87
107
  /**
88
108
  * The text to search in the index.
89
109
  */
90
110
  query: string;
111
+
91
112
  /**
92
113
  * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.
93
114
  */
94
115
  queryAfterRemoval?: string;
116
+
95
117
  /**
96
118
  * Actual host name of the server that processed the request.
97
119
  */
98
120
  serverUsed?: string;
121
+
99
122
  /**
100
123
  * Lets you store custom data in your indices.
101
124
  */
102
125
  userData?: Record<string, any>;
126
+
103
127
  renderingContent?: RenderingContent;
104
128
  };
@@ -4,10 +4,12 @@ import type { TrendingModels } from './trendingModels';
4
4
 
5
5
  export type BaseTrendingRequest = {
6
6
  model: TrendingModels;
7
+
7
8
  /**
8
9
  * The facet name to use for trending models.
9
10
  */
10
11
  facetName?: string;
12
+
11
13
  /**
12
14
  * The facet value to use for trending models.
13
15
  */
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ /**
4
+ * Enables de-duplication or grouping of results.
5
+ */
6
+ export type Distinct = boolean | number;
@@ -8,6 +8,7 @@ import type { Value } from './value';
8
8
  */
9
9
  export type FacetOrdering = {
10
10
  facets?: Facets;
11
+
11
12
  /**
12
13
  * The ordering of facet values, within an individual list.
13
14
  */
@@ -5,14 +5,17 @@ export type FacetsStats = {
5
5
  * The minimum value in the result set.
6
6
  */
7
7
  min?: number;
8
+
8
9
  /**
9
10
  * The maximum value in the result set.
10
11
  */
11
12
  max?: number;
13
+
12
14
  /**
13
15
  * The average facet value in the result set.
14
16
  */
15
17
  avg?: number;
18
+
16
19
  /**
17
20
  * The sum of all values in the result set.
18
21
  */
@@ -10,11 +10,14 @@ export type HighlightResultOption = {
10
10
  * Markup text with occurrences highlighted.
11
11
  */
12
12
  value: string;
13
+
13
14
  matchLevel: MatchLevel;
15
+
14
16
  /**
15
17
  * List of words from the query that matched the object.
16
18
  */
17
19
  matchedWords: string[];
20
+
18
21
  /**
19
22
  * Whether the entire attribute value is highlighted.
20
23
  */
package/model/index.ts CHANGED
@@ -10,6 +10,7 @@ export * from './baseSearchParams';
10
10
  export * from './baseSearchParamsWithoutQuery';
11
11
  export * from './baseSearchResponse';
12
12
  export * from './baseTrendingRequest';
13
+ export * from './distinct';
13
14
  export * from './errorBase';
14
15
  export * from './exactOnSingleWordQuery';
15
16
  export * from './facetFilters';
@@ -2,6 +2,7 @@
2
2
 
3
3
  import type { AdvancedSyntaxFeatures } from './advancedSyntaxFeatures';
4
4
  import type { AlternativesAsExact } from './alternativesAsExact';
5
+ import type { Distinct } from './distinct';
5
6
  import type { ExactOnSingleWordQuery } from './exactOnSingleWordQuery';
6
7
  import type { IgnorePlurals } from './ignorePlurals';
7
8
  import type { QueryType } from './queryType';
@@ -15,147 +16,185 @@ export type IndexSettingsAsSearchParams = {
15
16
  * The complete list of attributes that will be used for faceting.
16
17
  */
17
18
  attributesForFaceting?: string[];
18
- /**
19
- * List of attributes that can\'t be retrieved at query time.
20
- */
21
- unretrievableAttributes?: string[];
19
+
22
20
  /**
23
21
  * This parameter controls which attributes to retrieve and which not to retrieve.
24
22
  */
25
23
  attributesToRetrieve?: string[];
24
+
26
25
  /**
27
26
  * Restricts a given query to look in only a subset of your searchable attributes.
28
27
  */
29
28
  restrictSearchableAttributes?: string[];
29
+
30
30
  /**
31
31
  * Controls how Algolia should sort your results.
32
32
  */
33
33
  ranking?: string[];
34
+
34
35
  /**
35
36
  * Specifies the custom ranking criterion.
36
37
  */
37
38
  customRanking?: string[];
39
+
38
40
  /**
39
41
  * Controls the relevancy threshold below which less relevant results aren\'t included in the results.
40
42
  */
41
43
  relevancyStrictness?: number;
44
+
42
45
  /**
43
46
  * List of attributes to highlight.
44
47
  */
45
48
  attributesToHighlight?: string[];
49
+
46
50
  /**
47
51
  * List of attributes to snippet, with an optional maximum number of words to snippet.
48
52
  */
49
53
  attributesToSnippet?: string[];
54
+
50
55
  /**
51
56
  * The HTML string to insert before the highlighted parts in all highlight and snippet results.
52
57
  */
53
58
  highlightPreTag?: string;
59
+
54
60
  /**
55
61
  * The HTML string to insert after the highlighted parts in all highlight and snippet results.
56
62
  */
57
63
  highlightPostTag?: string;
64
+
58
65
  /**
59
66
  * String used as an ellipsis indicator when a snippet is truncated.
60
67
  */
61
68
  snippetEllipsisText?: string;
69
+
62
70
  /**
63
71
  * Restrict highlighting and snippeting to items that matched the query.
64
72
  */
65
73
  restrictHighlightAndSnippetArrays?: boolean;
74
+
66
75
  /**
67
76
  * Set the number of hits per page.
68
77
  */
69
78
  hitsPerPage?: number;
79
+
70
80
  /**
71
81
  * Minimum number of characters a word in the query string must contain to accept matches with 1 typo.
72
82
  */
73
83
  minWordSizefor1Typo?: number;
84
+
74
85
  /**
75
86
  * Minimum number of characters a word in the query string must contain to accept matches with 2 typos.
76
87
  */
77
88
  minWordSizefor2Typos?: number;
89
+
78
90
  typoTolerance?: TypoTolerance;
91
+
79
92
  /**
80
93
  * Whether to allow typos on numbers (\"numeric tokens\") in the query string.
81
94
  */
82
95
  allowTyposOnNumericTokens?: boolean;
96
+
83
97
  /**
84
98
  * List of attributes on which you want to disable typo tolerance.
85
99
  */
86
100
  disableTypoToleranceOnAttributes?: string[];
101
+
87
102
  ignorePlurals?: IgnorePlurals;
103
+
88
104
  removeStopWords?: RemoveStopWords;
105
+
89
106
  /**
90
107
  * List of characters that the engine shouldn\'t automatically normalize.
91
108
  */
92
109
  keepDiacriticsOnCharacters?: string;
110
+
93
111
  /**
94
112
  * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.
95
113
  */
96
114
  queryLanguages?: string[];
115
+
97
116
  /**
98
117
  * Splits compound words into their composing atoms in the query.
99
118
  */
100
119
  decompoundQuery?: boolean;
120
+
101
121
  /**
102
122
  * Whether Rules should be globally enabled.
103
123
  */
104
124
  enableRules?: boolean;
125
+
105
126
  /**
106
127
  * Enable the Personalization feature.
107
128
  */
108
129
  enablePersonalization?: boolean;
130
+
109
131
  queryType?: QueryType;
132
+
110
133
  removeWordsIfNoResults?: RemoveWordsIfNoResults;
134
+
111
135
  /**
112
136
  * Enables the advanced query syntax.
113
137
  */
114
138
  advancedSyntax?: boolean;
139
+
115
140
  /**
116
141
  * A list of words that should be considered as optional when found in the query.
117
142
  */
118
143
  optionalWords?: string[];
144
+
119
145
  /**
120
146
  * List of attributes on which you want to disable the exact ranking criterion.
121
147
  */
122
148
  disableExactOnAttributes?: string[];
149
+
123
150
  exactOnSingleWordQuery?: ExactOnSingleWordQuery;
151
+
124
152
  /**
125
153
  * List of alternatives that should be considered an exact match by the exact ranking criterion.
126
154
  */
127
155
  alternativesAsExact?: AlternativesAsExact[];
156
+
128
157
  /**
129
158
  * Allows you to specify which advanced syntax features are active when ‘advancedSyntax\' is enabled.
130
159
  */
131
160
  advancedSyntaxFeatures?: AdvancedSyntaxFeatures[];
161
+
162
+ distinct?: Distinct;
163
+
132
164
  /**
133
- * Enables de-duplication or grouping of results.
165
+ * Name of the de-duplication attribute to be used with the distinct feature.
134
166
  */
135
- distinct?: number;
167
+ attributeForDistinct?: string;
168
+
136
169
  /**
137
170
  * Whether to take into account an index\'s synonyms for a particular search.
138
171
  */
139
172
  synonyms?: boolean;
173
+
140
174
  /**
141
175
  * Whether to highlight and snippet the original word that matches the synonym or the synonym itself.
142
176
  */
143
177
  replaceSynonymsInHighlight?: boolean;
178
+
144
179
  /**
145
180
  * Precision of the proximity ranking criterion.
146
181
  */
147
182
  minProximity?: number;
183
+
148
184
  /**
149
185
  * Choose which fields to return in the API response. This parameters applies to search and browse queries.
150
186
  */
151
187
  responseFields?: string[];
188
+
152
189
  /**
153
190
  * Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100.
154
191
  */
155
192
  maxFacetHits?: number;
193
+
156
194
  /**
157
195
  * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.
158
196
  */
159
197
  attributeCriteriaComputedByMinProximity?: boolean;
198
+
160
199
  renderingContent?: RenderingContent;
161
200
  };
@@ -5,10 +5,12 @@ export type MatchedGeoLocation = {
5
5
  * Latitude of the matched location.
6
6
  */
7
7
  lat?: number;
8
+
8
9
  /**
9
10
  * Longitude of the matched location.
10
11
  */
11
12
  lng?: number;
13
+
12
14
  /**
13
15
  * Distance between the matched location and the search location (in meters).
14
16
  */