Date fix
Browse files
app.py
CHANGED
@@ -81,14 +81,21 @@ def search():
|
|
81 |
else: results = client.search(collection_name=collection_name, query_vector=(qvector, sq), with_payload=True, limit=100)
|
82 |
print('SEARCH TIME: ', time.time() - timh)
|
83 |
|
84 |
-
print(results[0])
|
85 |
# try:
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
else:
|
88 |
-
new_results = []
|
89 |
for r in results:
|
90 |
-
if 'context' in r.payload and r.payload['context'] != '':
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
results = new_results
|
93 |
return jsonify(results)
|
94 |
# except:
|
|
|
81 |
else: results = client.search(collection_name=collection_name, query_vector=(qvector, sq), with_payload=True, limit=100)
|
82 |
print('SEARCH TIME: ', time.time() - timh)
|
83 |
|
84 |
+
#print(results[0])
|
85 |
# try:
|
86 |
+
new_results = []
|
87 |
+
if collection_name == 'jks':
|
88 |
+
for r in results:
|
89 |
+
if 'date' not in r.payload: r.payload['date'] = '20200101'
|
90 |
+
new_results.append({"text": r.payload['text'], "date": str(int(r.payload['date'])), "id": r.id}) # Implement your Qdrant search here
|
91 |
else:
|
|
|
92 |
for r in results:
|
93 |
+
if 'context' in r.payload and r.payload['context'] != '':
|
94 |
+
if 'date' not in r.payload: r.payload['date'] = '20200101'
|
95 |
+
new_results.append({"text": r.payload['title'] + '\nContext: ' + r.payload['context'], "url": r.payload['url'], "date": r.payload['date'], "id": r.id})
|
96 |
+
else:
|
97 |
+
if 'date' not in r.payload: r.payload['date'] = '20200101'
|
98 |
+
new_results.append({"text": r.payload['title'], "url": r.payload['url'], "date": r.payload['date'], "id": r.id})
|
99 |
results = new_results
|
100 |
return jsonify(results)
|
101 |
# except:
|