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

Support: 'Fetch >1000 documents with a POST query' using with_total option #52

Merged
merged 4 commits into from
Aug 2, 2022

Conversation

sengineer0
Copy link
Collaborator

Regarding to this issue: biothings#233
this PR try to support fetching >1000 documents with a POST query, by adding a new with_total option.

  • if with_total option is not included in the POST body, or set to False, the result of query api will be same as the original behaviour: return a list of documents which match the query terms.
  • if with_total option is set to True, the result will be reformated as a dict, which looks like this:
{
    'max_total': 100,  // the total documents matchs the query terms.
    'msg': '12 query terms return > 1000 hits, using from=1000 to retrieve the remaining hits',  // only included if there is at least one query term return greater than <size> of hits. the <size> value will be the options.size or default to 1000 if not set.
    'hits': [...]  // the actual response's documents
}

@sengineer0 sengineer0 requested a review from newgene July 29, 2022 06:41
@sengineer0 sengineer0 force-pushed the add-with-total-options-to-query-api branch from 29051a1 to 39b40d1 Compare July 29, 2022 06:41
biothings/web/query/formatter.py Outdated Show resolved Hide resolved
biothings/web/query/formatter.py Outdated Show resolved Hide resolved
biothings/web/query/formatter.py Outdated Show resolved Hide resolved
biothings/web/query/formatter.py Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

2 participants