fix: Handle is_search_module_loaded for redis version < 4.0.0 (#27574)

- Return False if error occurs
This commit is contained in:
Marica
2021-09-18 14:23:44 +05:30
committed by GitHub
parent 666eaae6ce
commit d6ed6d53e9

View File

@@ -20,14 +20,16 @@ def get_indexable_web_fields():
return [df.fieldname for df in valid_fields]
def is_search_module_loaded():
cache = frappe.cache()
out = cache.execute_command('MODULE LIST')
try:
cache = frappe.cache()
out = cache.execute_command('MODULE LIST')
parsed_output = " ".join(
(" ".join([s.decode() for s in o if not isinstance(s, int)]) for o in out)
)
return "search" in parsed_output
parsed_output = " ".join(
(" ".join([s.decode() for s in o if not isinstance(s, int)]) for o in out)
)
return "search" in parsed_output
except Exception:
return False
def if_redisearch_loaded(function):
"Decorator to check if Redisearch is loaded."