Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When page is 1, TypesenseQueryError is returned #41

Open
chimd715 opened this issue Sep 19, 2023 · 2 comments
Open

When page is 1, TypesenseQueryError is returned #41

chimd715 opened this issue Sep 19, 2023 · 2 comments

Comments

@chimd715
Copy link

Description

When I query with "page": 1, then Exception: TypesenseQueryError: {'code': 400, 'error': 'Parameter 'page' must be an unsigned integer.'} is returned

It seems like following line is causing problem (Here is the link to the code. https://github.com/typesense/typesense-python/blob/e22e31df314371b41cc57527c4583f3451a2f63d/typesense/api_call.py#L139C1-L139C1 )

# typesense-python/typesense/api_call.py:139-140
if params[key] == True:
   params[key] = 'true'

Steps to reproduce

Using typesense==0.17.0, just query anything with "page": 1

Expected Behavior

First page results should be returned.

Actual Behavior

Exception: TypesenseQueryError: {'code': 400, 'error': 'Parameter 'page' must be an unsigned integer.'}

Metadata

Typesense Version:
0.16.0, 0.17.0

OS:
macOS Ventura 13.4.1

@chimd715
Copy link
Author

Also when drop_tokens_threshold, typo_tokens_threshold is 0. This is really annoying. Is this intended behavior?

@cdewbery
Copy link

I just ran into this issue while attempting to set the "per_page" to 1 while attempting a multi search, as a work around I ended up converting the value to a string.

for example:

per_page = 1

common_search_params =  {
    "per_page" : str(per_page)
}

client.multi_search.perform(search_requests, common_search_params)

This prevents the normalize_params() function from replacing it with "true" but the resulting POST request is still sent with this parameter set as an integer

POST /multi_search?per_page=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants