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

filter by journal doesn't appear to work as expected #89

Closed
tracy55 opened this issue Apr 7, 2020 · 5 comments
Closed

filter by journal doesn't appear to work as expected #89

tracy55 opened this issue Apr 7, 2020 · 5 comments
Assignees

Comments

@tracy55
Copy link

tracy55 commented Apr 7, 2020

I would like to filter results by journal but the API does not seem to be respecting the filter and returns random journals while the FE search works as expected:

api: https://api.cord19.vespa.ai/search/?query=covid-19&summary=short&ranking=freshness&year=2020&fieldset=all&journal=The+Lancet
FE: https://cord19.vespa.ai/search?query=covid-19&summary=short&ranking=freshness&year=2020&fieldset=all&journal=The+Lancet

Am I doing something wrong?

@frodelu
Copy link
Member

frodelu commented Apr 7, 2020

@tracy55 Thank you for filing this.

When querying the API, you cannot use the same GET parameters as you see in the frontend or the frontend query language. You need to use the Vespa YQL query language through the Vespa Search API.

Some examples are listed in the CORD-19 documentation under "Example API queries".

I'll update this issue with your exact query shortly.

@frodelu frodelu self-assigned this Apr 7, 2020
@frodelu
Copy link
Member

frodelu commented Apr 7, 2020

@tracy55 Your specific FE query would translate to something like this:
https://api.cord19.vespa.ai/search/?query=covid-19&summary=short&ranking=freshness&yql=select%20*%20from%20sources%20*%20where%20userQuery()%20and%20timestamp%20%3E%201577836800%20and%20journal%20contains%20%22the%20lancet%22%3b

Or - if using a POST request with the JSON (a bit easier to work with) it would look like this:

{
  'yql': 'select * from sources * where userQuery() and timestamp > 1577836800 and journal contains "the lancet";',
  'summary': 'short',
  'query': 'covid-19',
  'ranking': 'freshness'
}

Hope this helps.

@tracy55
Copy link
Author

tracy55 commented Apr 7, 2020

Thank you @frodelu this is very helpful, much appreciated.

@frodelu frodelu closed this as completed Apr 7, 2020
@tracy55
Copy link
Author

tracy55 commented Apr 10, 2020

@bratseth
Copy link
Member

About 10-15 ms. Where are you calling us from, and do you use persistent connections?

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

3 participants