Skip to content

Commit 4598159

Browse files
authored
Check server version in vector search to determine if the example will work or not (#246)
1 parent 8e4a630 commit 4598159

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.github/workflows/run-examples-with-release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
coherence-image:
1818
- ghcr.io/oracle/coherence-ce
1919
coherenceVersion:
20+
- 22.06.12
2021
- 25.03.1
2122
runs-on: ${{ matrix.os }}
2223
steps:

.github/workflows/run-examples.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
coherence-image:
2222
- ghcr.io/oracle/coherence-ce
2323
coherenceVersion:
24+
- 22.06.12
2425
- 25.03.1
2526
runs-on: ${{ matrix.os }}
2627
steps:

examples/vector_search.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ async def do_run() -> None:
231231
# Create a new session to the Coherence server using the default host and
232232
# port i.e. localhost:1408
233233
session: Session = await Session.create()
234+
# Check if the example cmn be run against the server
235+
if (session._protocol_version == 1) and (
236+
(session._proxy_version > "24.09.2") or (session._proxy_version > "15.0.0")
237+
):
238+
# Server supports vector search - continue on
239+
pass
240+
else:
241+
# Server does not support vector search - exit out
242+
return
243+
234244
# Create a NamedMap called movies with key of str and value of dict
235245
movie_db: NamedMap[str, dict] = await session.get_map("movies")
236246
try:

0 commit comments

Comments
 (0)