Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -370,13 +370,12 @@ def perform_search_and_get_results_histroy_filter(collection_name, query, refere
|
|
| 370 |
filters.append(models.FieldCondition(key="paragraph", match=models.MatchValue(value=paragraph_number+'a')))
|
| 371 |
if characters:
|
| 372 |
filters.append(models.FieldCondition(key="characters", match=models.MatchValue(value=characters+'a')))
|
| 373 |
-
|
| 374 |
# Perform the search
|
| 375 |
history_results = client.search(
|
| 376 |
collection_name=collection_name,
|
| 377 |
query_filter=models.Filter(should=filters),
|
| 378 |
query_vector=model.encode(query).tolist(),
|
| 379 |
-
limit=
|
| 380 |
)
|
| 381 |
|
| 382 |
return history_results
|
|
@@ -412,6 +411,7 @@ def history():
|
|
| 412 |
except Exception as e:
|
| 413 |
return jsonify({'error': str(e)}), 500
|
| 414 |
|
|
|
|
| 415 |
# History approach ends here :
|
| 416 |
if __name__ == '__main__':
|
| 417 |
app.debug = True
|
|
|
|
| 370 |
filters.append(models.FieldCondition(key="paragraph", match=models.MatchValue(value=paragraph_number+'a')))
|
| 371 |
if characters:
|
| 372 |
filters.append(models.FieldCondition(key="characters", match=models.MatchValue(value=characters+'a')))
|
|
|
|
| 373 |
# Perform the search
|
| 374 |
history_results = client.search(
|
| 375 |
collection_name=collection_name,
|
| 376 |
query_filter=models.Filter(should=filters),
|
| 377 |
query_vector=model.encode(query).tolist(),
|
| 378 |
+
limit=2
|
| 379 |
)
|
| 380 |
|
| 381 |
return history_results
|
|
|
|
| 411 |
except Exception as e:
|
| 412 |
return jsonify({'error': str(e)}), 500
|
| 413 |
|
| 414 |
+
|
| 415 |
# History approach ends here :
|
| 416 |
if __name__ == '__main__':
|
| 417 |
app.debug = True
|