leantext 1.0.5__cp38-abi3-win_amd64.whl → 1.0.6__cp38-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
leantext/leantext.pyd
CHANGED
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
leantext\__init__.py,sha256=gc6BKLkTF6zMXaN3OGq2DJkxElZCxkvsVBd0G2IG8jc,115
|
|
2
|
+
leantext\leantext.pyd,sha256=df0xphI176EI6ghW97-tGtzACD3QDjg_ZYnTAqqk9Rk,2405376
|
|
3
|
+
leantext-1.0.6.dist-info\METADATA,sha256=ma0e0yLdVifvrHo-P-JKquLBQg_8kUnUf88BQgMBtgA,628
|
|
4
|
+
leantext-1.0.6.dist-info\WHEEL,sha256=gPqN4EsdiAyGvmfrYy_ONrF276O8o0hPitI2CKZrEFA,95
|
|
5
|
+
leantext_engine.py,sha256=YNpsg2vNR-5NW3LgvtxzW3I-kKKQrZwAqMKlFT_id3g,25997
|
|
6
|
+
leantext-1.0.6.dist-info\RECORD,,
|
leantext_engine.py
CHANGED
|
@@ -256,13 +256,14 @@ class LeanTextEngine:
|
|
|
256
256
|
cols.add(name)
|
|
257
257
|
return list(cols)
|
|
258
258
|
|
|
259
|
-
def add(self, content: str, metadata: Optional[Dict[str, Any]] = None, doc_id: Optional[str] = None, collection: str = "default") -> str:
|
|
259
|
+
def add(self, content: str, title: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None, doc_id: Optional[str] = None, collection: str = "default") -> str:
|
|
260
260
|
"""Adds a single document. Returns the document ID."""
|
|
261
|
-
return self.add_batch([content], [metadata] if metadata else None, [doc_id] if doc_id else None, collection)[0]
|
|
261
|
+
return self.add_batch([content], [title] if title else None, [metadata] if metadata else None, [doc_id] if doc_id else None, collection)[0]
|
|
262
262
|
|
|
263
263
|
def add_batch(
|
|
264
264
|
self,
|
|
265
265
|
contents: List[str],
|
|
266
|
+
titles: Optional[List[str]] = None,
|
|
266
267
|
metadatas: Optional[List[Dict[str, Any]]] = None,
|
|
267
268
|
ids: Optional[List[str]] = None,
|
|
268
269
|
collection: str = "default"
|
|
@@ -294,6 +295,9 @@ class LeanTextEngine:
|
|
|
294
295
|
meta = copy.deepcopy(meta_orig) if meta_orig else {}
|
|
295
296
|
meta = self._sanitize_metadata(meta)
|
|
296
297
|
|
|
298
|
+
# Title handling
|
|
299
|
+
title = titles[i] if titles and i < len(titles) else None
|
|
300
|
+
|
|
297
301
|
# ID handling
|
|
298
302
|
provided_id = ids[i] if i < len(ids) else None
|
|
299
303
|
doc_id = str(provided_id or meta.get("id") or meta.get("_id") or uuid.uuid4())
|
|
@@ -305,7 +309,8 @@ class LeanTextEngine:
|
|
|
305
309
|
except orjson.JSONEncodeError:
|
|
306
310
|
meta_json = orjson.dumps({"id": doc_id}).decode('utf-8')
|
|
307
311
|
|
|
308
|
-
|
|
312
|
+
# Update: Pass title to Rust
|
|
313
|
+
db.add(doc_id, text, title, meta_json)
|
|
309
314
|
result_ids.append(doc_id)
|
|
310
315
|
|
|
311
316
|
# Persist and version tracking (only if thread_safe)
|
|
@@ -426,7 +431,7 @@ class LeanTextEngine:
|
|
|
426
431
|
db = self._ensure_collection(collection)
|
|
427
432
|
filter_str = orjson.dumps(filters).decode('utf-8') if filters else None
|
|
428
433
|
|
|
429
|
-
# Returns: Vec<(String, f32, String, Option<String>)>
|
|
434
|
+
# Returns: Vec<(String, f32, String, String, Option<String>)>
|
|
430
435
|
raw_results = db.search(
|
|
431
436
|
query,
|
|
432
437
|
filter_str,
|
|
@@ -453,7 +458,7 @@ class LeanTextEngine:
|
|
|
453
458
|
)
|
|
454
459
|
|
|
455
460
|
results = []
|
|
456
|
-
for doc_id, score, meta_str, content in raw_results:
|
|
461
|
+
for doc_id, score, title, meta_str, content in raw_results:
|
|
457
462
|
try:
|
|
458
463
|
meta = orjson.loads(meta_str)
|
|
459
464
|
except (TypeError, orjson.JSONDecodeError):
|
|
@@ -462,6 +467,7 @@ class LeanTextEngine:
|
|
|
462
467
|
res = {
|
|
463
468
|
"id": doc_id,
|
|
464
469
|
"score": score,
|
|
470
|
+
"title": title,
|
|
465
471
|
"metadata": meta
|
|
466
472
|
}
|
|
467
473
|
if return_content:
|
leantext-1.0.5.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
leantext\__init__.py,sha256=gc6BKLkTF6zMXaN3OGq2DJkxElZCxkvsVBd0G2IG8jc,115
|
|
2
|
-
leantext\leantext.pyd,sha256=h_N4r94imTEIBy3wWKoXRum5yDWoMOoq6tljVasQZmU,2356224
|
|
3
|
-
leantext-1.0.5.dist-info\METADATA,sha256=n60uNaI7lqtsV4EaFGNrApFr5pLDCYHb31uwTjhXs2E,628
|
|
4
|
-
leantext-1.0.5.dist-info\WHEEL,sha256=gPqN4EsdiAyGvmfrYy_ONrF276O8o0hPitI2CKZrEFA,95
|
|
5
|
-
leantext_engine.py,sha256=j616JL1hf89lboKF0g8wJ9QU_D6McbqSBDUnCuxzoho,25683
|
|
6
|
-
leantext-1.0.5.dist-info\RECORD,,
|
|
File without changes
|