torque-http 0.5.0__tar.gz → 0.6.0__tar.gz

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.
@@ -0,0 +1,196 @@
1
+ TORQUE END-USER LICENSE AGREEMENT (EULA)
2
+
3
+ Copyright (c) 2025-2026 Truespar. All rights reserved.
4
+
5
+ IMPORTANT — READ CAREFULLY: This End-User License Agreement ("Agreement") is a
6
+ legal agreement between you (either an individual or a single entity, "Licensee")
7
+ and Truespar ("Licensor") for the Torque software,
8
+ including all source code, binaries, documentation, and associated files
9
+ (collectively, the "Software").
10
+
11
+ By downloading, installing, copying, or otherwise using the Software, you agree
12
+ to be bound by the terms of this Agreement. If you do not agree, do not use the
13
+ Software.
14
+
15
+ 1. GRANT OF LICENSE
16
+
17
+ Subject to the terms of this Agreement, Licensor grants Licensee a limited,
18
+ non-exclusive, non-transferable, revocable license to:
19
+
20
+ (a) Use the Software for internal purposes, including evaluation, development,
21
+ and production deployment.
22
+
23
+ (b) Create applications and services that interface with the Software through
24
+ its published APIs (Bolt protocol, FFI bindings, gRPC, and CLI).
25
+
26
+ 2. RESTRICTIONS
27
+
28
+ Licensee shall NOT:
29
+
30
+ (a) Modify, adapt, alter, translate, or create derivative works of the
31
+ Software or any part thereof.
32
+
33
+ (b) Reverse engineer, disassemble, decompile, or otherwise attempt to derive
34
+ the source code, underlying ideas, algorithms, data structures, or
35
+ non-public APIs of the Software. To the extent that applicable law
36
+ (including EU Directive 2009/24/EC) grants a non-waivable right to
37
+ decompile for interoperability purposes, Licensee must first provide
38
+ thirty (30) days' prior written notice to Licensor and may exercise such
39
+ right only to the minimum extent necessary to achieve interoperability
40
+ with independently created software.
41
+
42
+ (c) Redistribute, sublicense, lease, rent, loan, sell, or otherwise transfer
43
+ the Software or any rights therein to any third party.
44
+
45
+ (d) Remove, alter, or obscure any proprietary notices, labels, or marks on
46
+ the Software.
47
+
48
+ (e) Use the Software to operate a service bureau, outsourcing service, or
49
+ managed-service offering for the benefit of third parties, or to provide
50
+ database-as-a-service offerings based on the Software, without a separate
51
+ commercial agreement with the Licensor.
52
+
53
+ (f) Use the Software to build a product or service that competes with the
54
+ Software.
55
+
56
+ (g) Publish benchmark results, performance comparisons, or similar evaluations
57
+ of the Software without prior written consent of the Licensor.
58
+
59
+ 3. INTELLECTUAL PROPERTY
60
+
61
+ The Software is the intellectual property of the Licensor and is protected by
62
+ copyright law and international treaties. Licensor retains all right, title,
63
+ and interest in and to the Software, including all intellectual property rights
64
+ therein. This Agreement does not convey any ownership interest in the Software.
65
+
66
+ 4. FEEDBACK
67
+
68
+ If Licensee provides suggestions, ideas, enhancement requests, or other
69
+ feedback regarding the Software ("Feedback"), Licensor may freely use,
70
+ incorporate, modify, license, and distribute such Feedback without restriction,
71
+ attribution, or compensation to Licensee. Licensee hereby assigns to Licensor
72
+ all right, title, and interest in and to any Feedback.
73
+
74
+ 5. CONFIDENTIALITY
75
+
76
+ (a) "Confidential Information" means the source code, object code, algorithms,
77
+ data structures, architecture, internal APIs, performance characteristics,
78
+ and any other non-public technical or business information of the Licensor
79
+ disclosed to or accessed by Licensee, whether in written, electronic, or
80
+ other form.
81
+
82
+ (b) Licensee shall hold all Confidential Information in strict confidence,
83
+ using at least the same degree of care it uses to protect its own
84
+ confidential information, but no less than reasonable care.
85
+
86
+ (c) Licensee shall not disclose Confidential Information to any third party
87
+ without the prior written consent of Licensor, except to Licensee's
88
+ employees or contractors who have a need to know and are bound by
89
+ confidentiality obligations at least as protective as those herein.
90
+
91
+ (d) The obligations in this section do not apply to information that:
92
+ (i) is or becomes publicly available through no fault of Licensee;
93
+ (ii) was rightfully known to Licensee prior to disclosure by Licensor;
94
+ (iii) is independently developed by Licensee without use of or reference
95
+ to the Confidential Information; or (iv) is required to be disclosed by
96
+ law, provided Licensee gives Licensor prompt written notice and
97
+ cooperates to limit the scope of disclosure.
98
+
99
+ (e) These confidentiality obligations survive termination of this Agreement
100
+ for a period of five (5) years, or indefinitely for trade secrets for as
101
+ long as they remain trade secrets under applicable law.
102
+
103
+ 6. THIRD-PARTY COMPONENTS
104
+
105
+ The Software incorporates open-source components licensed under permissive
106
+ licenses (MIT, Apache-2.0, BSD, and similar). These components retain their
107
+ original licenses. A list of third-party components and their licenses is
108
+ provided in the THIRD-PARTY-NOTICES file included with the Software.
109
+
110
+ Nothing in this Agreement restricts, limits, or otherwise affects any rights
111
+ Licensee may have under the licenses of such third-party components.
112
+
113
+ 7. NO WARRANTY
114
+
115
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
118
+ LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN
119
+ ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN
120
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
121
+
122
+ 8. LIMITATION OF LIABILITY
123
+
124
+ (a) IN NO EVENT SHALL LICENSOR'S TOTAL AGGREGATE LIABILITY TO LICENSEE FOR
125
+ ALL CLAIMS ARISING UNDER OR IN CONNECTION WITH THIS AGREEMENT EXCEED THE
126
+ GREATER OF: (I) THE TOTAL AMOUNT OF FEES ACTUALLY PAID BY LICENSEE TO
127
+ LICENSOR FOR THE SOFTWARE DURING THE TWELVE (12) MONTHS IMMEDIATELY
128
+ PRECEDING THE EVENT GIVING RISE TO THE CLAIM; OR (II) FIFTY US DOLLARS
129
+ (USD $50.00).
130
+
131
+ (b) IN NO EVENT SHALL LICENSOR BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
132
+ SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO
133
+ LOSS OF PROFITS, DATA, BUSINESS, OR GOODWILL, REGARDLESS OF THE CAUSE OF
134
+ ACTION OR THE THEORY OF LIABILITY, EVEN IF LICENSOR HAS BEEN ADVISED OF
135
+ THE POSSIBILITY OF SUCH DAMAGES.
136
+
137
+ (c) THE LIMITATIONS IN SUBSECTIONS (a) AND (b) ABOVE SHALL NOT APPLY TO
138
+ LIABILITY ARISING FROM: (I) FRAUD OR FRAUDULENT MISREPRESENTATION;
139
+ (II) GROSS NEGLIGENCE OR WILLFUL MISCONDUCT; (III) LICENSEE'S BREACH OF
140
+ SECTIONS 2 (RESTRICTIONS) OR 5 (CONFIDENTIALITY); OR (IV) EITHER PARTY'S
141
+ INDEMNIFICATION OBLIGATIONS UNDER SECTION 9.
142
+
143
+ 9. INDEMNIFICATION
144
+
145
+ (a) Licensee shall defend, indemnify, and hold harmless Licensor and its
146
+ officers, directors, employees, and agents from and against any and all
147
+ third-party claims, damages, losses, liabilities, costs, and expenses
148
+ (including reasonable attorneys' fees) arising out of or related to:
149
+ (i) Licensee's breach of this Agreement, including but not limited to the
150
+ restrictions in Section 2 and the confidentiality obligations in
151
+ Section 5; (ii) Licensee's use of the Software in violation of applicable
152
+ law; or (iii) Licensee's gross negligence or willful misconduct.
153
+
154
+ (b) Licensor shall promptly notify Licensee of any such claim and provide
155
+ reasonable cooperation at Licensee's expense. Licensee shall have sole
156
+ control of the defense and settlement, provided that any settlement
157
+ requiring Licensor to admit liability or pay money shall require
158
+ Licensor's prior written consent.
159
+
160
+ 10. TERMINATION
161
+
162
+ (a) This Agreement is effective until terminated.
163
+
164
+ (b) Licensor may terminate this Agreement immediately upon written notice if
165
+ Licensee breaches Section 2 (Restrictions), Section 5 (Confidentiality),
166
+ or Section 9 (Indemnification).
167
+
168
+ (c) For any other material breach, the non-breaching party may terminate this
169
+ Agreement if the breaching party fails to cure such breach within thirty
170
+ (30) days of receiving written notice thereof.
171
+
172
+ (d) Upon termination, Licensee must immediately cease all use of the Software
173
+ and destroy all copies (including backups) in its possession or control
174
+ within five (5) business days. Upon Licensor's request, Licensee shall
175
+ certify such destruction in writing.
176
+
177
+ (e) Sections 2, 3, 4, 5, 7, 8, 9, 11, and 12 survive termination of this
178
+ Agreement.
179
+
180
+ 11. GOVERNING LAW
181
+
182
+ This Agreement shall be governed by and construed in accordance with the laws
183
+ of the State of Delaware, United States, without regard to its conflict-of-law
184
+ provisions. The United Nations Convention on Contracts for the International
185
+ Sale of Goods is expressly excluded. Any disputes arising under this Agreement
186
+ shall be resolved exclusively in the state or federal courts located in the
187
+ State of Delaware. Notwithstanding the foregoing, Licensor may seek injunctive
188
+ or other equitable relief in any court of competent jurisdiction to protect its
189
+ intellectual property rights or Confidential Information.
190
+
191
+ 12. ENTIRE AGREEMENT
192
+
193
+ This Agreement constitutes the entire agreement between the parties with
194
+ respect to the Software and supersedes all prior negotiations, representations,
195
+ or agreements relating thereto. No modification of this Agreement shall be
196
+ binding unless in writing and signed by both parties.
@@ -1,16 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: torque-http
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Official Python client for Torque — Truespar's in-memory search engine with a Typesense v30.1 compatible API. Zero external dependencies.
5
5
  Project-URL: Homepage, https://truespar.com/torque/docs
6
6
  Project-URL: Documentation, https://truespar.com/torque/docs
7
7
  Author: Truespar
8
- License-Expression: MIT
8
+ License-Expression: LicenseRef-Proprietary
9
9
  License-File: LICENSE
10
10
  Keywords: search,torque,truespar,typesense,vector-search
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
@@ -30,7 +29,7 @@ Official Python client for [Torque](https://truespar.com/torque/docs) — Truesp
30
29
  - **TQBF file upload** for bulk import
31
30
  - Multi-node failover with automatic retry
32
31
  - Typed search parameters and response models
33
- - Python 3.10+, MIT licensed
32
+ - Python 3.10+
34
33
 
35
34
  ## Installation
36
35
 
@@ -129,4 +128,4 @@ client.import_binary("products", "data.tqbf")
129
128
 
130
129
  ## License
131
130
 
132
- MIT — see [LICENSE](LICENSE).
131
+ Copyright 2025-2026 Truespar. All rights reserved. See [LICENSE](LICENSE).
@@ -8,7 +8,7 @@ Official Python client for [Torque](https://truespar.com/torque/docs) — Truesp
8
8
  - **TQBF file upload** for bulk import
9
9
  - Multi-node failover with automatic retry
10
10
  - Typed search parameters and response models
11
- - Python 3.10+, MIT licensed
11
+ - Python 3.10+
12
12
 
13
13
  ## Installation
14
14
 
@@ -107,4 +107,4 @@ client.import_binary("products", "data.tqbf")
107
107
 
108
108
  ## License
109
109
 
110
- MIT — see [LICENSE](LICENSE).
110
+ Copyright 2025-2026 Truespar. All rights reserved. See [LICENSE](LICENSE).
@@ -4,17 +4,17 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "torque-http"
7
- version = "0.5.0"
7
+ version = "0.6.0"
8
8
  description = "Official Python client for Torque — Truespar's in-memory search engine with a Typesense v30.1 compatible API. Zero external dependencies."
9
9
  readme = "README.md"
10
- license = "MIT"
10
+ license = "LicenseRef-Proprietary"
11
+ license-files = ["LICENSE"]
11
12
  requires-python = ">=3.10"
12
13
  authors = [{ name = "Truespar" }]
13
14
  keywords = ["search", "torque", "typesense", "truespar", "vector-search"]
14
15
  classifiers = [
15
16
  "Development Status :: 4 - Beta",
16
17
  "Intended Audience :: Developers",
17
- "License :: OSI Approved :: MIT License",
18
18
  "Programming Language :: Python :: 3.10",
19
19
  "Programming Language :: Python :: 3.11",
20
20
  "Programming Language :: Python :: 3.12",
@@ -118,4 +118,4 @@ __all__ = [
118
118
  "TorqueConnectionError",
119
119
  ]
120
120
 
121
- __version__ = "0.5.0"
121
+ __version__ = "0.6.0"
@@ -1,6 +1,6 @@
1
1
  """Torque Python HTTP client — zero external dependencies.
2
2
 
3
- Uses only Python 3.13+ stdlib: http.client, json, ssl, threading.
3
+ Uses only Python 3.10+ stdlib: http.client, json, ssl, threading.
4
4
  Features: connection pooling with keep-alive, multi-node round-robin,
5
5
  configurable retry with exponential backoff, typed error hierarchy.
6
6
  """
@@ -813,7 +813,7 @@ class TorqueHttpClient:
813
813
  if params is not None:
814
814
  merged.update(params)
815
815
  merged.update(kwargs)
816
- qs = urlencode({k: v for k, v in merged.items() if v is not None})
816
+ qs = _encode_search_params(merged)
817
817
  d = self._get(f"/collections/{_enc(collection)}/documents/search?{qs}")
818
818
  return _parse_search(d)
819
819
 
@@ -837,7 +837,7 @@ class TorqueHttpClient:
837
837
  if params is not None:
838
838
  merged.update(params)
839
839
  merged.update(kwargs)
840
- qs = urlencode({k: v for k, v in merged.items() if v is not None})
840
+ qs = _encode_search_params(merged)
841
841
  d = self._get(f"/collections/{_enc(collection)}/documents/search?{qs}")
842
842
  return _parse_grouped_search(d)
843
843
 
@@ -866,6 +866,44 @@ class TorqueHttpClient:
866
866
  d = self._post("/multi_search", {"searches": searches})
867
867
  return [_parse_search(r) for r in d.get("results", [])]
868
868
 
869
+ def multi_search_union(
870
+ self,
871
+ searches: list[dict[str, Any]],
872
+ common_params: dict[str, Any] | None = None,
873
+ *,
874
+ page: int | None = None,
875
+ per_page: int | None = None,
876
+ ) -> SearchResult:
877
+ """Execute multiple searches merged into one ranked result set.
878
+
879
+ Uses Typesense v30.1 ``union: true`` — hits from all searches are
880
+ merged and ranked by text_match. Not compatible with ``group_by``
881
+ searches.
882
+
883
+ Args:
884
+ searches: List of search parameter dicts, each with at least
885
+ ``collection`` and ``q`` keys.
886
+ common_params: Optional dict of parameters merged into every
887
+ search. Per-search values override common values.
888
+ page: Page number for the merged result set (1-based).
889
+ per_page: Results per page for the merged result set.
890
+
891
+ Returns:
892
+ A single SearchResult with the merged, ranked hits.
893
+ """
894
+ if common_params:
895
+ searches = [{**common_params, **s} for s in searches]
896
+ path = "/multi_search"
897
+ query: list[str] = []
898
+ if page is not None:
899
+ query.append(f"page={page}")
900
+ if per_page is not None:
901
+ query.append(f"per_page={per_page}")
902
+ if query:
903
+ path += "?" + "&".join(query)
904
+ d = self._post(path, {"searches": searches, "union": True})
905
+ return _parse_search(d)
906
+
869
907
  # ── Aliases ────────────────────────────────────────────────────────
870
908
 
871
909
  def upsert_alias(self, name: str, collection_name: str) -> CollectionAlias:
@@ -1413,6 +1451,15 @@ def _enc(s: str) -> str:
1413
1451
  return quote(s, safe="")
1414
1452
 
1415
1453
 
1454
+ def _encode_search_params(params: dict[str, Any]) -> str:
1455
+ """URL-encode search params, serializing Python bools as true/false."""
1456
+ return urlencode({
1457
+ k: ("true" if v is True else "false" if v is False else v)
1458
+ for k, v in params.items()
1459
+ if v is not None
1460
+ })
1461
+
1462
+
1416
1463
  def _parse_collection(d: dict) -> CollectionResponse:
1417
1464
  return CollectionResponse(
1418
1465
  name=d.get("name", ""),
@@ -171,10 +171,15 @@ class SearchParameters(TypedDict, total=False):
171
171
  facet_by: str
172
172
  max_facet_values: int
173
173
  facet_query: str
174
+ facet_strategy: str
175
+ facet_sample_percent: int
176
+ facet_sample_threshold: int
177
+ facet_return_parent: str
174
178
 
175
179
  # ── Grouping ──────────────────────────────────────────────────────
176
180
  group_by: str
177
181
  group_limit: int
182
+ group_missing_values: bool
178
183
 
179
184
  # ── Pagination ────────────────────────────────────────────────────
180
185
  per_page: int
@@ -191,6 +196,7 @@ class SearchParameters(TypedDict, total=False):
191
196
  highlight_full_fields: str
192
197
  highlight_start_tag: str
193
198
  highlight_end_tag: str
199
+ highlight_affix_num_tokens: int
194
200
  snippet_threshold: int
195
201
 
196
202
  # ── Pinning / hiding ──────────────────────────────────────────────
@@ -200,17 +206,41 @@ class SearchParameters(TypedDict, total=False):
200
206
 
201
207
  # ── Token dropping ────────────────────────────────────────────────
202
208
  drop_tokens_threshold: int
209
+ drop_tokens_mode: str
203
210
  typo_tokens_threshold: int
204
211
 
212
+ # ── Typo tolerance ────────────────────────────────────────────────
213
+ min_len_1typo: int
214
+ min_len_2typo: int
215
+ split_join_tokens: str
216
+ synonym_num_typos: int
217
+ enable_typos_for_numerical_tokens: bool
218
+ enable_typos_for_alpha_numerical_tokens: bool
219
+
220
+ # ── Infix search ──────────────────────────────────────────────────
221
+ infix: str
222
+ max_extra_prefix: int
223
+ max_extra_suffix: int
224
+
205
225
  # ── Performance ───────────────────────────────────────────────────
206
226
  exhaustive_search: bool
207
227
  search_cutoff_ms: int
228
+ max_candidates: int
229
+
230
+ # ── Caching ───────────────────────────────────────────────────────
231
+ use_cache: bool
232
+ cache_ttl: int
233
+
234
+ # ── Validation & toggles ──────────────────────────────────────────
235
+ validate_field_names: bool
236
+ enable_synonyms: bool
208
237
 
209
238
  # ── Preset ────────────────────────────────────────────────────────
210
239
  preset: str
211
240
 
212
- # ── Stopwords ─────────────────────────────────────────────────────
241
+ # ── Stopwords & synonyms ──────────────────────────────────────────
213
242
  stopwords: str
243
+ synonym_sets: str
214
244
 
215
245
  # ── Vector search ─────────────────────────────────────────────────
216
246
  vector_query: str
torque_http-0.5.0/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Truespar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
File without changes