Spaces:
Runtime error
Runtime error
Update simple_search_engine/search_engine.py
Browse files
simple_search_engine/search_engine.py
CHANGED
|
@@ -100,7 +100,13 @@ class SimpleSearchEngine:
|
|
| 100 |
results = []
|
| 101 |
for idx in ranked_idx:
|
| 102 |
doc = self.documents[idx]
|
| 103 |
-
results.append(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
return results
|
| 106 |
|
|
@@ -114,7 +120,13 @@ class SimpleSearchEngine:
|
|
| 114 |
results = []
|
| 115 |
for idx in ranked_idx:
|
| 116 |
doc = self.documents[idx]
|
| 117 |
-
results.append(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
return results
|
| 120 |
|
|
@@ -143,6 +155,12 @@ class SimpleSearchEngine:
|
|
| 143 |
results = []
|
| 144 |
for idx in ranked_idx:
|
| 145 |
doc = self.documents[idx]
|
| 146 |
-
results.append(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
return results
|
|
|
|
| 100 |
results = []
|
| 101 |
for idx in ranked_idx:
|
| 102 |
doc = self.documents[idx]
|
| 103 |
+
results.append({
|
| 104 |
+
"title": doc["title"],
|
| 105 |
+
"url": doc["url"],
|
| 106 |
+
"path": doc["path"],
|
| 107 |
+
"text": doc["text"],
|
| 108 |
+
"score": float(scores[idx])
|
| 109 |
+
})
|
| 110 |
|
| 111 |
return results
|
| 112 |
|
|
|
|
| 120 |
results = []
|
| 121 |
for idx in ranked_idx:
|
| 122 |
doc = self.documents[idx]
|
| 123 |
+
results.append({
|
| 124 |
+
"title": doc["title"],
|
| 125 |
+
"url": doc["url"],
|
| 126 |
+
"path": doc["path"],
|
| 127 |
+
"text": doc["text"],
|
| 128 |
+
"score": float(scores[idx])
|
| 129 |
+
})
|
| 130 |
|
| 131 |
return results
|
| 132 |
|
|
|
|
| 155 |
results = []
|
| 156 |
for idx in ranked_idx:
|
| 157 |
doc = self.documents[idx]
|
| 158 |
+
results.append({
|
| 159 |
+
"title": doc["title"],
|
| 160 |
+
"url": doc["url"],
|
| 161 |
+
"path": doc["path"],
|
| 162 |
+
"text": doc["text"],
|
| 163 |
+
"score": float(hybrid_scores[idx])
|
| 164 |
+
})
|
| 165 |
|
| 166 |
return results
|