algoliasearch-client-javascript icon indicating copy to clipboard operation
algoliasearch-client-javascript copied to clipboard

multipleQueries should be in lite client

Open kopax-polyconseil opened this issue 2 years ago • 4 comments

Hello,

We are using the search features and want to use the lite client, however, the multipleQueries method is not available in it while it is still a search feature.

How can we use the search lite client to optimize our bundle size, could the multipleQueries be added in it and how ?

Thanks in advance

Related issues: https://github.com/algolia/algoliasearch-client-javascript/issues/1421

kopax-polyconseil avatar Sep 07 '22 15:09 kopax-polyconseil

It seems it is present in algoliasearch-lite.esm.browser.js , but the typing is wrong.

kopax-polyconseil avatar Sep 07 '22 15:09 kopax-polyconseil

Fun fact, the light version in algoliasearch/lite is exporting the non lite version. Only import possible is import algoliasearch from 'algoliasearch/dist/algoliasearch-lite.esm.browser.js' and not only the typing is wrongly type for the lite version, but also it is poorly configured to allow this import.

kopax-polyconseil avatar Sep 07 '22 16:09 kopax-polyconseil

the method search exists, which is preferred over multipleQueries, does that solve your use case before the typings would be updated?

Haroenv avatar Sep 08 '22 06:09 Haroenv

Hello, no we have to patch-package in order to solve our use case because:

  • Typing for lite vesrion is wrong, the lite version include multipleQueries but not it's typing
  • lite.js export wrong version (non lite)
  • browser field use umd imports while our react-native is web ios and android, and can use ESM which is more optimized (it will be minified by webpack, and it doesn't include the UMD unecessary synthax)

This is our PR: https://github.com/pass-culture/pass-culture-app-native/pull/3523

We haven't found another way to do so for all iOS Android and Web.

It was possible to fix the web only using Webpack resolve.alias configuration, because UMD file is bigger than ESM when builded, but this didn't solve the issue for the native app.

I suggest to keep the issue open until this matter is resolved.

kopax-polyconseil avatar Sep 08 '22 09:09 kopax-polyconseil