+3
database.py
+3
database.py
···
262
262
return False
263
263
264
264
def upsert_post(self, did: str, uri: str, text: str, vector: List[float]):
265
+
word_ct = len(text.split())
266
+
265
267
try:
266
268
payload = {
267
269
"did": did,
268
270
"uri": uri,
269
271
"text": text,
272
+
"word_count": word_ct,
270
273
"timestamp": create_now_timestamp(),
271
274
}
272
275
+7
search.py
+7
search.py
···
6
6
import click
7
7
from qdrant_client.models import (
8
8
DatetimeRange,
9
+
Direction,
9
10
FieldCondition,
10
11
Filter,
11
12
MatchValue,
13
+
OrderBy,
12
14
)
13
15
from rich.console import Console
14
16
from rich.table import Table
···
303
305
),
304
306
]
305
307
),
308
+
order_by=OrderBy(
309
+
key="timestamp",
310
+
direction=Direction.DESC,
311
+
),
312
+
limit=30,
306
313
with_payload=True,
307
314
with_vectors=True,
308
315
)[0]