Skip to content

Commit 8da94d6

Browse files
committed
fix(client,notebooks): validate properties type in create_text_index; document hybrid index prerequisite; guard health() return value in notebooks
1 parent 518a61f commit 8da94d6

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

coordinode/coordinode/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,10 @@ async def create_text_index(
623623
_validate_cypher_identifier(label, "label")
624624
if isinstance(properties, str):
625625
prop_list = [properties]
626-
else:
626+
elif isinstance(properties, list | tuple):
627627
prop_list = list(properties)
628+
else:
629+
raise ValueError("'properties' must be a property name (str) or a list of property names")
628630
if not prop_list:
629631
raise ValueError("'properties' must contain at least one property name")
630632
for prop in prop_list:
@@ -785,6 +787,12 @@ async def hybrid_text_vector_search(
785787
786788
Returns:
787789
List of :class:`HybridResult` ordered by RRF score descending.
790+
791+
Note:
792+
A full-text index covering *label* **must exist** before calling this
793+
method — create one with :meth:`create_text_index` or a
794+
``CREATE TEXT INDEX`` Cypher statement. Calling this method on a
795+
label without a text index returns an empty list.
788796
"""
789797
from coordinode._proto.coordinode.v1.query.text_pb2 import ( # type: ignore[import]
790798
HybridTextVectorSearchRequest,

demo/notebooks/00_seed_data.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@
151151
" from coordinode import CoordinodeClient\n",
152152
"\n",
153153
" client = CoordinodeClient(COORDINODE_ADDR)\n",
154-
" client.health()\n",
154+
" if not client.health():\n",
155+
" raise RuntimeError(f\"Health check failed for {COORDINODE_ADDR}\")\n",
155156
" print(f\"Connected to {COORDINODE_ADDR}\")\n",
156157
"else:\n",
157158
" try:\n",
@@ -164,7 +165,8 @@
164165
" from coordinode import CoordinodeClient\n",
165166
"\n",
166167
" client = CoordinodeClient(COORDINODE_ADDR)\n",
167-
" client.health()\n",
168+
" if not client.health():\n",
169+
" raise RuntimeError(f\"Health check failed for {COORDINODE_ADDR}\")\n",
168170
" print(f\"Connected to {COORDINODE_ADDR}\")\n",
169171
" else:\n",
170172
" # No server available — use the embedded in-process engine.\n",

demo/notebooks/02_langchain_graph_chain.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@
170170
" from coordinode import CoordinodeClient\n",
171171
"\n",
172172
" client = CoordinodeClient(COORDINODE_ADDR)\n",
173-
" client.health()\n",
173+
" if not client.health():\n",
174+
" raise RuntimeError(f\"Health check failed for {COORDINODE_ADDR}\")\n",
174175
" print(f\"Connected to {COORDINODE_ADDR}\")\n",
175176
"else:\n",
176177
" try:\n",
@@ -183,7 +184,8 @@
183184
" from coordinode import CoordinodeClient\n",
184185
"\n",
185186
" client = CoordinodeClient(COORDINODE_ADDR)\n",
186-
" client.health()\n",
187+
" if not client.health():\n",
188+
" raise RuntimeError(f\"Health check failed for {COORDINODE_ADDR}\")\n",
187189
" print(f\"Connected to {COORDINODE_ADDR}\")\n",
188190
" else:\n",
189191
" # No server available — use the embedded in-process engine.\n",

0 commit comments

Comments
 (0)