nucliadb 6.3.5.post3911__py3-none-any.whl → 6.3.5.post3914__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.
@@ -18,6 +18,7 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  #
20
20
  import asyncio
21
+ import re
21
22
  import string
22
23
  from datetime import datetime
23
24
  from typing import Any, Awaitable, Optional
@@ -69,6 +70,10 @@ INDEX_SORTABLE_FIELDS = [
69
70
 
70
71
  DEFAULT_GENERIC_SEMANTIC_THRESHOLD = 0.7
71
72
 
73
+ # -* is an invalid query in tantivy and it won't return results but if you add some whitespaces
74
+ # between - and *, it will actually trigger a tantivy bug and panic
75
+ INVALID_QUERY = re.compile(r"- +\*")
76
+
72
77
 
73
78
  class QueryParser:
74
79
  """
@@ -197,6 +202,11 @@ class QueryParser:
197
202
  - incomplete: If the query is incomplete (missing vectors)
198
203
  - autofilters: The autofilters that were applied
199
204
  """
205
+
206
+ # Filter some queries that panic tantivy, better than returning the 500
207
+ if INVALID_QUERY.search(self.query):
208
+ raise InvalidQueryError("query", "Invalid query syntax")
209
+
200
210
  request = nodereader_pb2.SearchRequest()
201
211
  request.body = self.query
202
212
  request.with_duplicates = self.with_duplicates
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.3.5.post3911
3
+ Version: 6.3.5.post3914
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
21
  Requires-Python: <4,>=3.9
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: nucliadb-telemetry[all]>=6.3.5.post3911
24
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.5.post3911
25
- Requires-Dist: nucliadb-protos>=6.3.5.post3911
26
- Requires-Dist: nucliadb-models>=6.3.5.post3911
27
- Requires-Dist: nidx-protos>=6.3.5.post3911
23
+ Requires-Dist: nucliadb-telemetry[all]>=6.3.5.post3914
24
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.5.post3914
25
+ Requires-Dist: nucliadb-protos>=6.3.5.post3914
26
+ Requires-Dist: nucliadb-models>=6.3.5.post3914
27
+ Requires-Dist: nidx-protos>=6.3.5.post3914
28
28
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
29
29
  Requires-Dist: nuclia-models>=0.24.2
30
30
  Requires-Dist: uvicorn[standard]
@@ -239,7 +239,7 @@ nucliadb/search/search/metrics.py,sha256=GGGtXHLhK79_ESV277xkBVjcaMURXHCxYG0EdGa
239
239
  nucliadb/search/search/paragraphs.py,sha256=pNAEiYqJGGUVcEf7xf-PFMVqz0PX4Qb-WNG-_zPGN2o,7799
240
240
  nucliadb/search/search/pgcatalog.py,sha256=s_J98fsX_RuFXwpejpkGqG-tD9ELuzz4YQ6U3ew5h2g,9313
241
241
  nucliadb/search/search/predict_proxy.py,sha256=IFI3v_ODz2_UU1XZnyaD391fE7-2C0npSmj_HmDvzS4,3123
242
- nucliadb/search/search/query.py,sha256=CCz58Cs_VKxbwGO6VdhOzl9HXwKny2hfH2llJVR9emM,29859
242
+ nucliadb/search/search/query.py,sha256=Nc-RSP64Tb-R1znhp-MTkNSsrBnhaFEoFBV0NxOL9ZM,30267
243
243
  nucliadb/search/search/rank_fusion.py,sha256=tRGo_KlsFsVx1CQEy1iqQ6f0T1Dq1kf0axDXHuuzvvM,6946
244
244
  nucliadb/search/search/rerankers.py,sha256=3vep4EOVNeDJGsMdx-1g6Ar4ZGJG3IHym3HkxnbwtAQ,7321
245
245
  nucliadb/search/search/shards.py,sha256=OEtN1p9WX_cMX8t-myaafpmFAPTpUEOutR7z1sDuNcY,3242
@@ -356,8 +356,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
356
356
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
357
357
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
358
358
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
359
- nucliadb-6.3.5.post3911.dist-info/METADATA,sha256=V6qnHRQpApsjGkQoSMC-nOl2iWsabhBZaePimf1unLM,4301
360
- nucliadb-6.3.5.post3911.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
361
- nucliadb-6.3.5.post3911.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
362
- nucliadb-6.3.5.post3911.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
363
- nucliadb-6.3.5.post3911.dist-info/RECORD,,
359
+ nucliadb-6.3.5.post3914.dist-info/METADATA,sha256=_kbS1OuZddK3euMgqL96FHsWqVreZJPHIazpqsxSIzI,4301
360
+ nucliadb-6.3.5.post3914.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
361
+ nucliadb-6.3.5.post3914.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
362
+ nucliadb-6.3.5.post3914.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
363
+ nucliadb-6.3.5.post3914.dist-info/RECORD,,