cambialens / lens-api-doc

10 stars 5 forks source link

[Question] How do I search a list of paper by their titles in one query? #44

Closed yd34-1560609 closed 3 years ago

yd34-1560609 commented 3 years ago

I am trying to search 1000 papers at once and this query seems wrong. The 'count' is a list contains 1000 title's strings of paper. Will that work in any way? data = '''{ "query": { "terms": { "title": count } }, "size": 1000, "sort": [ { "year_published": "desc" } ] }'''

yd34-1560609 commented 3 years ago

I actually found out it was my python and JSON issue. But still, is this method possible for getting 1000 papers at once?

rosharma9 commented 3 years ago

You might need to use match phrase query like this:

{
    "query": {
        "bool": 
            {
                "should": [
                    {"match_phrase": {"title": "title string 1"}},
                    {"match_phrase": {"title": "title string 2"}},
                    ...
                ]
            }
    },
    "include":["lens_id", "external_ids", "source"]
}