Open ajay070993 opened 3 years ago
Sorting by score
would be the one you might be looking for. It is available for scholarly api. Patent will have it in upcoming release and we will update the api doc:
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "Palbociclib AND formulation",
"operator": "AND",
"fields": [
"title^3",
"fulltext",
"abstract"
]
}
}
]
}
},
"from": 0,
"size": 20,
"include": ["lens_id", "title", "abstract"],
"sort": [
{"score": "desc"}
]
}
Let me know if it is not what you were looking for.
Also please use the include
projection for sort requests.
I tried it. It is working fine but I want to show the same result order as in lens.org. I am getting the same number of results as lens but results order is different. { "query": "Palbociclib formulation", "from": 0, "size": 20, "include": ["lens_id", "title", "abstract"], "sort": [ {"score": "desc"} ] }
I am using this query.
On Thu, Jul 8, 2021 at 12:43 PM rosharma9 @.***> wrote:
Sorting by score would be the one you might be looking for. It is available for scholarly api. Patent will have it in upcoming release and we will update the api doc:
{ "query": { "bool": { "must": [ { "multi_match": { "query": "Palbociclib AND formulation", "operator": "AND", "fields": [ "title^3", "fulltext", "abstract" ] } } ] } }, "from": 0, "size": 20, "include": ["lens_id", "title", "abstract"], "sort": [ {"score": "desc"} ] }
Let me know if it is not what you were looking for. Also please use the include projection for sort requests.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cambialens/lens-api-doc/issues/46#issuecomment-876192593, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUJ3OLGM4CJL7CEN2FJ52LTWVF3BANCNFSM476MBT6Q .
Should be fixed now.
Looks good now.
On Fri, Jul 9, 2021 at 1:15 PM rosharma9 @.***> wrote:
Should be fixed now.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cambialens/lens-api-doc/issues/46#issuecomment-876986734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUJ3ONFZFRA2NFILBFY6PLTW2SJHANCNFSM476MBT6Q .
I was trying the below query but it is searching only across the title however I never mentioned the title name in this query.
{ "query": { "bool": { "must": { "query_string": { "query": "Palbociclib formulation", "default_operator": "and" } } } } }
I want to search across all the fields. I tried the below one that is working but I want to add filters as well so I need to use the above query. In fact above query should give the same results.
{ "query": "Palbociclib formulation", "from": 0, "size": 20, "include": ["lens_id", "title", "abstract"], "sort": [ {"score": "desc"} ] }
I already checked it but why we have to add fields in this. If I want to search in all fields. I want to search across all fields with some filters.
In other words what will be the query if I want to search for string "Palbociclib formulation" with year range 2000-2021 which give the same result as lens results in scholor
Guys, I am waiting for your reply. Please help me to impleement it
To make it easy we provide customised default search fields with just string input in query (like our web application). But for API users, we recommend to use the json based queries as it gives more flexibility in search.
Similar to example query:
{
"query": {
"bool": {
"must": [{
"query_string": {
"query": "Palbociclib formulation",
"fields": ["title", "abstract", "full_text"],
"default_operator": "and"
}
}],
"filter": {
"range": {
"year_published": {
"gt": "2000",
"lt": "2021"
}
}
}
}
}
}
If you still want to replicate the Lens web application style search, it can be used like this (not recommended):
{
"query": "Palbociclib formulation AND year_published:>2000 AND year_published:<2021"
}
Thanks for your reply but I don't think the result should be different from both. I want to get results from all fields.
"fields": ["title", "abstract", "full_text"]
Can you please let me know all key of all fields so I can pass all of them so I can get a similar count like the lens website?
I am able to search across the title, abstract, and full text but results are coming not in order as I want. I just want to show results in order. Like first results of title, then abstract after that full-text results.
is there any way to decide priorities?
I am using the following script.
{ "query": { "bool": { "must": [ { "multi_match": { "query": "Palbociclib AND formulation", "operator": "AND", "fields": ["title^3", "fulltext","abstract"] } } ] } }, "from": 0, "size": 20 }
I tried to put priorities by putting power but it is not working.