panosc-eu / panosc-search-scoring

3 stars 3 forks source link

itemsId parameter is ignored in endpoint `/score` #11

Closed antolinos closed 2 years ago

antolinos commented 2 years ago

Following the documentation the endpoint /score should filter the items by itemsId.

list of items id that needs to be scored in this request. Usually this list is provided by the catalogue system based on the hard filters provided. If no item ids are provided, all the items present in the database will be scored.

However, it does not seem to be the case and gets ignored returning an arbitrary number of items.

Example:

  url = "http://test-server:9000/score"
    try:
        myobj = {"itemsId": ["13411761", "20061268"], "query": "diffraction"}
        response = requests.post(url, json=myobj, timeout=5)
        if response.status_code < 400:
            scores = response.json()["scores"]
            print(len(scores))

prints:

806
nitrosx commented 2 years ago

@antolinos : thank you for submitting the issue. I do confirm that is an issue and I was able to reproduce it on our own deployment. I'm going to do some debugging and figure out where is the bug.

nitrosx commented 2 years ago

@antolinos Mistery solved. The correct syntax is with itemIds and not with itemsId.

url = "http://test-server:9000/score"
    try:
        myobj = {
           "itemIds": ["13411761", "20061268"], 
           "query": "diffraction"
        }
        response = requests.post(url, json=myobj, timeout=5)
        if response.status_code < 400:
            scores = response.json()["scores"]
            print(len(scores))

I will check the documentation to make sure that is correct.

nitrosx commented 2 years ago

Closing this issue for inactivity. Tested multiple times and documentation is fixed