typesense-instantsearch-adapter 2.7.0-3 → 2.7.0-4

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.
package/README.md CHANGED
@@ -475,7 +475,9 @@ const search = instantsearch({
475
475
  indexName: 'products',
476
476
  routing: true,
477
477
  async searchFunction(helper) {
478
- let query = helper.getQuery().query;
478
+ const query = helper.getQuery().query;
479
+ const page = helper.getPage(); // Retrieve the current page
480
+ const totalNearestNeighborsToFetch = 1000;
479
481
 
480
482
  if (query !== '') {
481
483
  // Get embedding for the query
@@ -491,11 +493,15 @@ const search = instantsearch({
491
493
  helper
492
494
  .setQueryParameter(
493
495
  'typesenseVectorQuery', // <=== Special parameter that only works in typesense-instantsearch-adapter@2.7.0-3 and above
494
- `vectors:([${parsedResponse['embedding'].join(',')}])`
496
+ `vectors:([${parsedResponse['embedding'].join(',')}], k:${totalNearestNeighborsToFetch})`
495
497
  )
498
+ .setPage(page)
496
499
  .search();
497
500
  } else {
498
- helper.setQueryParameter('typesenseVectorQuery', null).search();
501
+ helper
502
+ .setQueryParameter('typesenseVectorQuery', null)
503
+ .setPage(page)
504
+ .search();
499
505
  }
500
506
  },
501
507
  });
@@ -5345,22 +5345,22 @@ var Configuration = /** @class */ (function () {
5345
5345
  Configuration.prototype.isNodeMissingAnyParameters = function (node) {
5346
5346
  return (!['protocol', 'host', 'port', 'path'].every(function (key) {
5347
5347
  return node.hasOwnProperty(key);
5348
- }) && node.url == null);
5348
+ }) && node['url'] == null);
5349
5349
  };
5350
5350
  Configuration.prototype.setDefaultPathInNode = function (node) {
5351
5351
  if (node != null && !node.hasOwnProperty('path')) {
5352
- node.path = '';
5352
+ node['path'] = '';
5353
5353
  }
5354
5354
  return node;
5355
5355
  };
5356
5356
  Configuration.prototype.setDefaultPortInNode = function (node) {
5357
5357
  if (node != null && !node.hasOwnProperty('port') && node.hasOwnProperty('protocol')) {
5358
- switch (node.protocol) {
5358
+ switch (node['protocol']) {
5359
5359
  case 'https':
5360
- node.port = 443;
5360
+ node['port'] = 443;
5361
5361
  break;
5362
5362
  case 'http':
5363
- node.port = 80;
5363
+ node['port'] = 80;
5364
5364
  break;
5365
5365
  }
5366
5366
  }