koursaros-ai / nboost

NBoost is a scalable, search-api-boosting platform for deploying transformer models to improve the relevance of search results on different platforms (i.e. Elasticsearch)
Apache License 2.0
675 stars 69 forks source link

Search query not working... #77

Closed SagarPalyal closed 4 years ago

SagarPalyal commented 4 years ago

I have configured nboost with elasticsearch and tried retrieving some results. I found some strange behavior like not all the queries that work for elasticsearch actually working for nboost. I am trying hitting these queries from browser. Below are the scenarios: Working scenarios : Case1 , Case4 Not working scenarios: Case2, Case3, Case5

Case1 : ElasticSearch (Working) : http://localhost:9200//_search?q=&_source= Nboost (Working) : http://localhost:8000//_search?q=&_source=

Case2 : ElasticSearch (Working) : http://localhost:9200//_search?q=&_source=, Nboost (Not Working) : http://localhost:8000//_search?q=&_source=, {"doc":"Sequence index out of range.","msg":"('list index out of range',)","type":"IndexError"}

Case3: ElasticSearch (Working) : http://localhost:9200//_search?q=&_source= Nboost (Not Working) : http://localhost:8000//_search?q=&_source= {"doc":"Sequence index out of range.","msg":"('list index out of range',)","type":"IndexError"}

Case4: ElasticSearch (Working) : http://localhost:9200//_search?q=&_source=false Nboost (Working) : http://localhost:8000//_search?q=&_source=false

Case5: ElasticSearch (Working) : http://localhost:9200//_search?q= Nboost (Not Working) : http://localhost:8000//_search?q= {"doc":"Sequence index out of range.","msg":"('list index out of range',)","type":"IndexError"}

Please look into it. If there is any change in the query format using Nboost please let me know provided I am querying using browser.

SagarPalyal commented 4 years ago

The issue is coming because of re ranking of choices with ranks more than choices. Error source is base.py file.

Error causing line is :

remove ranks which are higher than total choices

    reranked_choices = [response.choices[rank] for rank in ranks]

Fix:

remove ranks which are higher than total choices

    ranks = [rank for rank in ranks if rank < len(response.choices)]
    reranked_choices = [response.choices[rank] for rank in ranks]
SagarPalyal commented 4 years ago

Hi All, Issue resolve and fixed. I am closing this issue. Thanks.