nucliadb 6.2.1.post3195__py3-none-any.whl → 6.2.1.post3204__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.
@@ -269,6 +269,7 @@ async def query_parser_from_find_request(
269
269
  kbid=kbid,
270
270
  features=item.features,
271
271
  query=item.query,
272
+ query_entities=item.query_entities,
272
273
  label_filters=item.filters,
273
274
  keyword_filters=item.keyword_filters,
274
275
  faceted=None,
@@ -24,6 +24,7 @@ from datetime import datetime
24
24
  from typing import Any, Awaitable, Optional, Union
25
25
 
26
26
  from nucliadb.common import datamanagers
27
+ from nucliadb.common.models_utils.from_proto import RelationNodeTypeMap
27
28
  from nucliadb.search import logger
28
29
  from nucliadb.search.predict import SendToPredictError
29
30
  from nucliadb.search.search.filters import (
@@ -49,6 +50,7 @@ from nucliadb_models.labels import LABEL_HIDDEN, translate_system_to_alias_label
49
50
  from nucliadb_models.metadata import ResourceProcessingStatus
50
51
  from nucliadb_models.search import (
51
52
  Filter,
53
+ KnowledgeGraphEntity,
52
54
  MaxTokens,
53
55
  MinScore,
54
56
  SearchOptions,
@@ -94,6 +96,7 @@ class QueryParser:
94
96
  keyword_filters: Union[list[str], list[Filter]],
95
97
  top_k: int,
96
98
  min_score: MinScore,
99
+ query_entities: Optional[list[KnowledgeGraphEntity]] = None,
97
100
  faceted: Optional[list[str]] = None,
98
101
  sort: Optional[SortOptions] = None,
99
102
  range_creation_start: Optional[datetime] = None,
@@ -120,6 +123,7 @@ class QueryParser:
120
123
  self.kbid = kbid
121
124
  self.features = features
122
125
  self.query = query
126
+ self.query_entities = query_entities
123
127
  self.hidden = hidden
124
128
  if self.hidden is not None:
125
129
  if self.hidden:
@@ -231,6 +235,7 @@ class QueryParser:
231
235
  self.parse_document_search(request)
232
236
  self.parse_paragraph_search(request)
233
237
  incomplete = await self.parse_vector_search(request)
238
+ # BUG: autofilters are not used to filter, but we say we do
234
239
  autofilters = await self.parse_relation_search(request)
235
240
  await self.parse_synonyms(request)
236
241
  await self.parse_min_score(request, incomplete)
@@ -372,8 +377,20 @@ class QueryParser:
372
377
 
373
378
  async def parse_relation_search(self, request: nodereader_pb2.SearchRequest) -> list[str]:
374
379
  autofilters = []
380
+ # BUG: autofiler should autofilter, not enable relation search
375
381
  if self.has_relations_search or self.autofilter:
376
- detected_entities = await self.fetcher.get_detected_entities()
382
+ if self.query_entities:
383
+ detected_entities = []
384
+ for entity in self.query_entities:
385
+ relation_node = utils_pb2.RelationNode()
386
+ relation_node.value = entity.name
387
+ if entity.type is not None:
388
+ relation_node.ntype = RelationNodeTypeMap[entity.type]
389
+ if entity.subtype is not None:
390
+ relation_node.subtype = entity.subtype
391
+ detected_entities.append(relation_node)
392
+ else:
393
+ detected_entities = await self.fetcher.get_detected_entities()
377
394
  meta_cache = await self.fetcher.get_entities_meta_cache()
378
395
  detected_entities = expand_entities(meta_cache, detected_entities)
379
396
  if self.has_relations_search:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb
3
- Version: 6.2.1.post3195
3
+ Version: 6.2.1.post3204
4
4
  Home-page: https://docs.nuclia.dev/docs/management/nucliadb/intro
5
5
  Author: NucliaDB Community
6
6
  Author-email: nucliadb@nuclia.com
@@ -22,10 +22,10 @@ Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3 :: Only
23
23
  Requires-Python: >=3.9, <4
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3195
26
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3195
27
- Requires-Dist: nucliadb-protos>=6.2.1.post3195
28
- Requires-Dist: nucliadb-models>=6.2.1.post3195
25
+ Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3204
26
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3204
27
+ Requires-Dist: nucliadb-protos>=6.2.1.post3204
28
+ Requires-Dist: nucliadb-models>=6.2.1.post3204
29
29
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
30
30
  Requires-Dist: nuclia-models>=0.24.2
31
31
  Requires-Dist: uvicorn
@@ -210,7 +210,7 @@ nucliadb/search/search/cut.py,sha256=ytY0_GY7ocNjfxTb4aosxEp4ZfhQNDP--JkhEMGD298
210
210
  nucliadb/search/search/exceptions.py,sha256=klGLgAGGrXcSGix_W6418ZBMqDchAIGjN77ofkOScEI,1039
211
211
  nucliadb/search/search/fetch.py,sha256=XJHIFnZmXM_8Kb37lb4lg1GYG7cZ1plT-qAIb_QziX4,6184
212
212
  nucliadb/search/search/filters.py,sha256=1MkHlJjAQqoRCj7e5cEzK2HvBxGLE17I_omsjiklbtw,6476
213
- nucliadb/search/search/find.py,sha256=DaO3CPBQqRAw-iK_DNf_gM-aEipjtuX6oA2TbAplkxs,9901
213
+ nucliadb/search/search/find.py,sha256=nu1o_7RlJZXibb5GCiUwlm3Lqf6fhT5tQS_6FuEu7rg,9945
214
214
  nucliadb/search/search/find_merge.py,sha256=5Aqz54E5GG8jw666KNncVHIJcs821ug-YwJ46YL6Br8,17363
215
215
  nucliadb/search/search/graph_strategy.py,sha256=Egcq_zn895gTUYmyQTsXj8YaUMa3HBKhcSa1GBvgzAM,31877
216
216
  nucliadb/search/search/hydrator.py,sha256=-R37gCrGxkyaiHQalnTWHNG_FCx11Zucd7qA1vQCxuw,6985
@@ -219,7 +219,7 @@ nucliadb/search/search/metrics.py,sha256=81X-tahGW4n2CLvUzCPdNxNClmZqUWZjcVOGCUH
219
219
  nucliadb/search/search/paragraphs.py,sha256=pNAEiYqJGGUVcEf7xf-PFMVqz0PX4Qb-WNG-_zPGN2o,7799
220
220
  nucliadb/search/search/pgcatalog.py,sha256=IaNK4dAxdXs38PoIkTdgqMDuZDjeiOtcXn3LeaT-OMw,8855
221
221
  nucliadb/search/search/predict_proxy.py,sha256=xBlh6kjuQpWRq7KsBx4pEl2PtnwljjQIiYMaTWpcCSA,3015
222
- nucliadb/search/search/query.py,sha256=doRdBhM928wB64v271RSyJxsRT5qd6oevImEMz4gpvw,29487
222
+ nucliadb/search/search/query.py,sha256=xBuXXD5cBhaWHotFKT_OkZ2Qgldsamb9bzKqlRvZ8do,30402
223
223
  nucliadb/search/search/rank_fusion.py,sha256=tRGo_KlsFsVx1CQEy1iqQ6f0T1Dq1kf0axDXHuuzvvM,6946
224
224
  nucliadb/search/search/rerankers.py,sha256=0kAHES9X_FKkP7KSN9NRETFmRPKzwrFAo_54MbyvM7Q,9051
225
225
  nucliadb/search/search/shards.py,sha256=JSRSrHgHcF4sXyuZZoJdMfK0v_LHpoSRf1lCr5-K5ko,2742
@@ -332,9 +332,9 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
332
332
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
333
333
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
334
334
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
335
- nucliadb-6.2.1.post3195.dist-info/METADATA,sha256=u16cJNcMWXsmH82kboXKVo3oDecmnKjtiTcW7G533eE,4603
336
- nucliadb-6.2.1.post3195.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
337
- nucliadb-6.2.1.post3195.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
338
- nucliadb-6.2.1.post3195.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
339
- nucliadb-6.2.1.post3195.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
340
- nucliadb-6.2.1.post3195.dist-info/RECORD,,
335
+ nucliadb-6.2.1.post3204.dist-info/METADATA,sha256=6LvmlhaONTvIU9ZJ8quoX2Gg8zmy1F8axSolwUptWy0,4603
336
+ nucliadb-6.2.1.post3204.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
337
+ nucliadb-6.2.1.post3204.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
338
+ nucliadb-6.2.1.post3204.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
339
+ nucliadb-6.2.1.post3204.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
340
+ nucliadb-6.2.1.post3204.dist-info/RECORD,,