nucliadb 6.6.1.post4700__py3-none-any.whl → 6.6.1.post4701__py3-none-any.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.
@@ -620,7 +620,11 @@ class Resource:
620
620
  assert self.basic is not None
621
621
  if not link_extracted_data.title:
622
622
  return
623
- if not (self.basic.title.startswith("http") or self.basic.title == ""):
623
+ if not (
624
+ self.basic.title.startswith("http")
625
+ or self.basic.title == ""
626
+ or self.basic.title == self.uuid
627
+ ):
624
628
  return
625
629
  title = link_extracted_data.title
626
630
  await self.update_resource_title(title)
@@ -20,7 +20,7 @@
20
20
  from inspect import iscoroutinefunction
21
21
  from typing import TYPE_CHECKING, Annotated, Callable, Optional, Type, Union
22
22
 
23
- from fastapi import HTTPException, Response
23
+ from fastapi import HTTPException, Query, Response
24
24
  from fastapi_versioning import version
25
25
  from starlette.requests import Request
26
26
 
@@ -541,6 +541,10 @@ async def reprocess_file_field(
541
541
  field_id: FieldIdString,
542
542
  x_nucliadb_user: Annotated[str, X_NUCLIADB_USER] = "",
543
543
  x_file_password: Annotated[Optional[str], X_FILE_PASSWORD] = None,
544
+ reset_title: bool = Query(
545
+ default=False,
546
+ description="Reset the title of the resource so that the file or link computed titles are set after processing.",
547
+ ),
544
548
  ) -> ResourceUpdated:
545
549
  await maybe_back_pressure(kbid, resource_uuid=rid)
546
550
 
@@ -590,6 +594,10 @@ async def reprocess_file_field(
590
594
  writer.kbid = kbid
591
595
  writer.uuid = rid
592
596
  writer.source = BrokerMessage.MessageSource.WRITER
597
+ if reset_title:
598
+ # Setting the title to the resource uuid will ensure that the newly processed link or file
599
+ # computed titles will be used as the resource title after processing.
600
+ writer.basic.title = rid
593
601
  writer.basic.metadata.useful = True
594
602
  writer.basic.metadata.status = Metadata.Status.PENDING
595
603
  writer.field_statuses.append(
@@ -394,9 +394,15 @@ async def reprocess_resource_rslug_prefix(
394
394
  kbid: str,
395
395
  rslug: str,
396
396
  x_nucliadb_user: Annotated[str, X_NUCLIADB_USER] = "",
397
+ reset_title: bool = Query(
398
+ default=False,
399
+ description="Reset the title of the resource so that the file or link computed titles are set after processing.",
400
+ ),
397
401
  ):
398
402
  rid = await get_rid_from_slug_or_raise_error(kbid, rslug)
399
- return await _reprocess_resource(request, kbid, rid, x_nucliadb_user=x_nucliadb_user)
403
+ return await _reprocess_resource(
404
+ request, kbid, rid, x_nucliadb_user=x_nucliadb_user, reset_title=reset_title
405
+ )
400
406
 
401
407
 
402
408
  @api.post(
@@ -413,8 +419,14 @@ async def reprocess_resource_rid_prefix(
413
419
  kbid: str,
414
420
  rid: str,
415
421
  x_nucliadb_user: Annotated[str, X_NUCLIADB_USER] = "",
422
+ reset_title: bool = Query(
423
+ default=False,
424
+ description="Reset the title of the resource so that the file or link computed titles are set after processing.",
425
+ ),
416
426
  ):
417
- return await _reprocess_resource(request, kbid, rid, x_nucliadb_user=x_nucliadb_user)
427
+ return await _reprocess_resource(
428
+ request, kbid, rid, x_nucliadb_user=x_nucliadb_user, reset_title=reset_title
429
+ )
418
430
 
419
431
 
420
432
  async def _reprocess_resource(
@@ -422,6 +434,10 @@ async def _reprocess_resource(
422
434
  kbid: str,
423
435
  rid: str,
424
436
  x_nucliadb_user: str,
437
+ reset_title: bool = Query(
438
+ default=False,
439
+ description="Reset the title of the resource so that the file or link computed titles are set after processing.",
440
+ ),
425
441
  ):
426
442
  await validate_rid_exists_or_raise_error(kbid, rid)
427
443
  await maybe_back_pressure(kbid, resource_uuid=rid)
@@ -464,6 +480,10 @@ async def _reprocess_resource(
464
480
  writer.kbid = kbid
465
481
  writer.uuid = rid
466
482
  writer.source = BrokerMessage.MessageSource.WRITER
483
+ if reset_title:
484
+ # Setting the title to the resource uuid will ensure that the newly processed link or file
485
+ # computed titles will be used as the resource title after processing.
486
+ writer.basic.title = rid
467
487
  writer.basic.metadata.useful = True
468
488
  writer.basic.metadata.status = Metadata.Status.PENDING
469
489
  await transaction.commit(writer, partition, wait=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.6.1.post4700
3
+ Version: 6.6.1.post4701
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: <4,>=3.9
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: nucliadb-telemetry[all]>=6.6.1.post4700
23
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.6.1.post4700
24
- Requires-Dist: nucliadb-protos>=6.6.1.post4700
25
- Requires-Dist: nucliadb-models>=6.6.1.post4700
26
- Requires-Dist: nidx-protos>=6.6.1.post4700
22
+ Requires-Dist: nucliadb-telemetry[all]>=6.6.1.post4701
23
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.6.1.post4701
24
+ Requires-Dist: nucliadb-protos>=6.6.1.post4701
25
+ Requires-Dist: nucliadb-models>=6.6.1.post4701
26
+ Requires-Dist: nidx-protos>=6.6.1.post4701
27
27
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
28
28
  Requires-Dist: nuclia-models>=0.43.0
29
29
  Requires-Dist: uvicorn[standard]
@@ -163,7 +163,7 @@ nucliadb/ingest/orm/exceptions.py,sha256=k4Esv4NtL4TrGTcsQpwrSfDhPQpiYcRbB1SpYmB
163
163
  nucliadb/ingest/orm/index_message.py,sha256=DWMTHJoVamUbK8opKl5csDvxfgz7c2j7phG1Ut4yIxk,15724
164
164
  nucliadb/ingest/orm/knowledgebox.py,sha256=_rkeTMIXMhR64gbYtZpFHoUHghV2DTJ2lUBqZsoqC_4,23898
165
165
  nucliadb/ingest/orm/metrics.py,sha256=OiuggTh-n3kZHA2G73NEUdIlh8c3yFrbusI88DK-Mko,1273
166
- nucliadb/ingest/orm/resource.py,sha256=yB0HWC3jc_1b-zXu-3FJCKOdAPPSb1aRBHpbZhsvyQk,37749
166
+ nucliadb/ingest/orm/resource.py,sha256=_wot5dZyPBhyva7tyFmVNnVpnH6d8YZsgiQj8lubBK0,37828
167
167
  nucliadb/ingest/orm/utils.py,sha256=fCQRuyecgqhaY7mcBG93oaXMkzkKb9BFjOcy4-ZiSNw,2693
168
168
  nucliadb/ingest/orm/processor/__init__.py,sha256=Aqd9wCNTvggkMkCY3WvoI8spdr94Jnqk-0iq9XpLs18,922
169
169
  nucliadb/ingest/orm/processor/auditing.py,sha256=TeYhXGJRyQ7ROytbb2u8R0fIh_FYi3HgTu3S1ribY3U,4623
@@ -352,10 +352,10 @@ nucliadb/writer/api/constants.py,sha256=qWEDjFUycrEZnSJyLnNK4PQNodU2oVmkO4NycaEZ
352
352
  nucliadb/writer/api/utils.py,sha256=wIQHlU8RQiIGVLI72suvyVIKlCU44Unh0Ae0IiN6Qwo,1313
353
353
  nucliadb/writer/api/v1/__init__.py,sha256=akI9A_jloNLb0dU4T5zjfdyvmSAiDeIdjAlzNx74FlU,1128
354
354
  nucliadb/writer/api/v1/export_import.py,sha256=v0sU55TtRSqDzwkDgcwv2uSaqKCuQTtGcMpYoHQYBQA,8192
355
- nucliadb/writer/api/v1/field.py,sha256=OicvLF1bnkJj1ixALFLuhvFX6NCMFpORROcFcS9nKpk,18505
355
+ nucliadb/writer/api/v1/field.py,sha256=Ky5XJa5gmCp6Ofnkm1tD0pOkq0rS00tKqxVeDeSVmQo,18926
356
356
  nucliadb/writer/api/v1/knowledgebox.py,sha256=PHEYDFa-sN5JrI8-EiVVg5FDOsRuCLT43kyAB4xt-xA,9530
357
357
  nucliadb/writer/api/v1/learning_config.py,sha256=CKBjqcbewkfPwGUPLDWzZSpro6XkmCaVppe5Qtpu5Go,3117
358
- nucliadb/writer/api/v1/resource.py,sha256=IaKHwP4M4Pm3xXj_xcnQCnTzKtXj_xj-r7YOHdH-89I,19750
358
+ nucliadb/writer/api/v1/resource.py,sha256=t0QSSre0l31eW1M5UgfU3AAoSMVlL5ExQYXdeKkGBks,20608
359
359
  nucliadb/writer/api/v1/router.py,sha256=RjuoWLpZer6Kl2BW_wznpNo6XL3BOpdTGqXZCn3QrrQ,1034
360
360
  nucliadb/writer/api/v1/services.py,sha256=3AUjk-SmvqJx76v7y89DZx6oyasojPliGYeniRQjpcU,13337
361
361
  nucliadb/writer/api/v1/slug.py,sha256=xlVBDBpRi9bNulpBHZwhyftVvulfE0zFm1XZIWl-AKY,2389
@@ -376,8 +376,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
376
376
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
377
377
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
378
378
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
379
- nucliadb-6.6.1.post4700.dist-info/METADATA,sha256=A_aHp-CWMHPO0E19OROR6udFDABya3QCGlC8lihrLts,4158
380
- nucliadb-6.6.1.post4700.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
381
- nucliadb-6.6.1.post4700.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
382
- nucliadb-6.6.1.post4700.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
383
- nucliadb-6.6.1.post4700.dist-info/RECORD,,
379
+ nucliadb-6.6.1.post4701.dist-info/METADATA,sha256=xPlyZpsl5gA068Ba_W3A7Qv-Ouzyes5Qa-J5OSM9NkQ,4158
380
+ nucliadb-6.6.1.post4701.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
381
+ nucliadb-6.6.1.post4701.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
382
+ nucliadb-6.6.1.post4701.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
383
+ nucliadb-6.6.1.post4701.dist-info/RECORD,,