AnswerDotAI / AnswerDotAI/RAGatouille
search not working after add_to_index
- Dominant language
- Python
- Stars
- 4k
- Forks
- 276
- PR merge metrics
- No merged PRs in 30d
Description
I was able to use add_to_index successfully. The new file contents appear in the collection.json and also the updated pid_docid_map.json (in the index directory). When I perform a search, the model seems to return the right index (no 55 in my case). However, it is blowing up as below:
File /opt/conda/lib/python3.11/site-packages/ragatouille/models/colbert.py:411, in ColBERT.search(self, query, index_name, k, force_fast, zero_index_ranks, doc_ids)
409 result_for_query = []
410 for id_, rank, score in zip(*result):
--> 411 document_id = self.pid_docid_map[id_]
412 result_dict = {
413 "content": self.collection[id_],
414 "score": score,
(...)
417 "passage_id": id_,
418 }
420 if self.docid_metadata_map is not None:
KeyError: 55
Is pid_docid_map getting properly read during search? Please note that the search works with the other indexes from the first document.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in models/colbert.py at the search path around line 411, then inspect how collection.json and pid_docid_map.json are loaded and updated by add_to_index. Reproduce by adding a file and searching the updated index; done means the new content can be returned without a KeyError for its passage ID.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100