typesense-js icon indicating copy to clipboard operation
typesense-js copied to clipboard

String `undefined` being attach to collection name.

Open danielcamargo opened this issue 3 years ago • 6 comments

Description

I am working on a Sveltekit product. On production only, the API call attaches a string undefined as part of the query.

image

this is the code:

const result = await client.collections('cards').documents().search({
      q: term,
      prefix: true,
      num_typos: '1',
      query_by: 'firstName,lastName',
      per_page: 10,
      sort_by: 'sort1:asc,sort2:asc',
      page: currentPage,
    });

Version: "typesense": "^1.1.3-0"

danielcamargo avatar Jan 12 '22 20:01 danielcamargo

Hmmm. @francoislg I wonder if this is somehow related to #97. But you said 1.1.3-0 worked in production with Sveltekit for you right?

jasonbosco avatar Jan 13 '22 01:01 jasonbosco

It is the same issue that we got, and we are running 1.1.3-0 in production 🤔

Our code is 95% the same as the code here, so I'm think it might be the client type?

We are using SearchClient, which uses SearchOnlyDocuments instead of Documents. Maybe my fix broke Documents when fixing SearchOnlyDocuments?

So

1- Do you have the same issue if you use a SearchClient instead (if you are currently using Client)? 2- Do you have the same issue with 1.1.2?

francoislg avatar Jan 13 '22 12:01 francoislg

@francoislg it worked with SearchClient. Thanks for your help!

danielcamargo avatar Jan 13 '22 19:01 danielcamargo

This means I probably broke the original Client 🤕

francoislg avatar Jan 13 '22 19:01 francoislg

I wonder if the same fix you did for SearchClient needs to also be done for Client, to get it to work with SvelteKit?

jasonbosco avatar Jan 13 '22 20:01 jasonbosco

I got super sidetracked but came back on this, is this still an issue ? 😓

francoislg avatar Feb 12 '22 17:02 francoislg