adsabs / oracle_service

Service that suggests article of interest to the reader or advices and scores the similarity between two records
MIT License
2 stars 2 forks source link

Sort option includes the desc direction by default #45

Open rjfarmer opened 2 years ago

rjfarmer commented 2 years ago

When calling the oracle/readhist endpoint, the sort option gets an extra desc appended. For instance asking for sort="first_author desc" then the query returned back to me by solr looks like this:

(similar(topn(5, reader:1b32642e059f2451, first_author desc desc)) entdate:[NOW-14DAYS TO *])

and I get a status=200 but "error from solr"

Setting the sort to be just "first_author" the returned query string is:

similar(topn(5, reader:1b32642e059f2451, first_author desc)) entdate:[NOW-14DAYS TO *])

and now I get a status=404 and "no result from solr with status code=200".

I assume the sort option was meant to be 'field' + 'direction' and not assume desc by default?

csgrant00 commented 2 years ago

Hi.

Sorry for the late reply. The sort order parameter accepts only the field not the direction.

And the reason why you are not getting any results back is because your level of readership is low. Meaning, you have to be logged in, and in the past 90 days, you need to be active for at least five days. Since ADS looks for these minimum levels of readership to identify regular users vs. occasional ones. Once your readership becomes a regular user, you should see recommendations from the main page and then using oracle you would receive results.

golnaz

On Thu, Aug 11, 2022 at 3:26 PM Robert Farmer @.***> wrote:

When calling the oracle/readhist endpoint, the sort option gets an extra desc appended. For instance asking for sort="first_author desc" then the query returned back to me by solr looks like this:

(similar(topn(5, reader:1b32642e059f2451, first_author desc desc)) entdate:[NOW-14DAYS TO *])

and I get a status=200 but "error from solr"

Setting the sort to be just "first_author" the returned query string is:

similar(topn(5, reader:1b32642e059f2451, first_author desc)) entdate:[NOW-14DAYS TO *])

and now I get a status=404 and "no result from solr with status code=200".

I assume the sort option was meant to be 'field' + 'direction' and not assume desc by default?

— Reply to this email directly, view it on GitHub https://github.com/adsabs/oracle_service/issues/45, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKDRFKGPQ6PLLGDQ55HQQDVYVHXLANCNFSM56JJREZA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

rjfarmer commented 2 years ago

Hi, Thanks for the response.

Might i suggest this would be helpful to document on https://ui.adsabs.harvard.edu/help/api/api-docs.html#post-/oracle/readhist . It wasn't clear to me I should possibly be expecting a 404 response (or that there was some sort of active status check).

Also do API queries count for the active status? I might not have logged in on a web-browser enough to trigger the active status but i've definitely run enough api queries that it should trigger (if they count).

Thanks