Skip to content

Commit 9563331

Browse files
authored
Merge pull request #396 from Fulin-Gao/main
【Fix】All content in examples/search were empty
2 parents 19e4628 + 1b6af44 commit 9563331

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

examples/search/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Train search agents using dense retrieval on Wikipedia with pre-built E5 embeddi
88
```bash
99
cd examples/search
1010
python download_search_data.py --data_dir ./search_data
11+
12+
cd examples/search/search_data/prebuilt_indices
13+
cat part_aa part_ab > e5_Flat.index
1114
```
1215

1316
Downloads:

examples/search/local_retrieval_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def _format_search_results(self, results: list[dict[str, Any]]) -> str:
9292
formatted_results = []
9393
for i, result in enumerate(results[: self.max_results], 1):
9494
# Extract key information
95-
doc_id = result.get("id", f"doc_{i}")
96-
content = result.get("content", "") # Fixed: use "content" not "contents"
95+
doc_id = result.get("document", {}).get("id", f"doc_{i}")
96+
content = result.get("document", {}).get("contents", "")
9797
score = result.get("score", 0.0)
9898

9999
# Truncate content if too long (keep first 300 characters)

0 commit comments

Comments
 (0)