|
25 | 25 | import redis.asyncio as aredis |
26 | 26 | from redis.commands.search.indexDefinition import IndexDefinition |
27 | 27 |
|
| 28 | +from redisvl.exceptions import RedisModuleVersionError |
28 | 29 | from redisvl.index.storage import BaseStorage, HashStorage, JsonStorage |
29 | 30 | from redisvl.query import BaseQuery, CountQuery, FilterQuery |
30 | 31 | from redisvl.query.filter import FilterExpression |
@@ -354,7 +355,17 @@ def from_existing( |
354 | 355 |
|
355 | 356 | # Validate modules |
356 | 357 | installed_modules = RedisConnectionFactory.get_modules(redis_client) |
357 | | - validate_modules(installed_modules, [{"name": "search", "ver": 20810}]) |
| 358 | + |
| 359 | + try: |
| 360 | + required_modules = [ |
| 361 | + {"name": "search", "ver": 20810}, |
| 362 | + {"name": "searchlight", "ver": 20810}, |
| 363 | + ] |
| 364 | + validate_modules(installed_modules, required_modules) |
| 365 | + except RedisModuleVersionError as e: |
| 366 | + raise RedisModuleVersionError( |
| 367 | + f"Loading from existing index failed. {str(e)}" |
| 368 | + ) |
358 | 369 |
|
359 | 370 | # Fetch index info and convert to schema |
360 | 371 | index_info = cls._info(name, redis_client) |
@@ -860,7 +871,17 @@ async def from_existing( |
860 | 871 |
|
861 | 872 | # Validate modules |
862 | 873 | installed_modules = await RedisConnectionFactory.get_modules_async(redis_client) |
863 | | - validate_modules(installed_modules, [{"name": "search", "ver": 20810}]) |
| 874 | + |
| 875 | + try: |
| 876 | + required_modules = [ |
| 877 | + {"name": "search", "ver": 20810}, |
| 878 | + {"name": "searchlight", "ver": 20810}, |
| 879 | + ] |
| 880 | + validate_modules(installed_modules, required_modules) |
| 881 | + except RedisModuleVersionError as e: |
| 882 | + raise RedisModuleVersionError( |
| 883 | + f"Loading from existing index failed. {str(e)}" |
| 884 | + ) from e |
864 | 885 |
|
865 | 886 | # Fetch index info and convert to schema |
866 | 887 | index_info = await cls._info(name, redis_client) |
|
0 commit comments