mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-06 23:10:26 +00:00
chore: resolve conflicts
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
@@ -37,18 +37,9 @@ def is_redisearch_enabled():
|
||||
def is_search_module_loaded():
|
||||
try:
|
||||
cache = frappe.cache()
|
||||
<<<<<<< HEAD
|
||||
out = cache.execute_command("MODULE LIST")
|
||||
|
||||
parsed_output = " ".join(
|
||||
" ".join([frappe.as_unicode(s) for s in o if not isinstance(s, int)]) for o in out
|
||||
)
|
||||
return "search" in parsed_output
|
||||
=======
|
||||
for module in cache.module_list():
|
||||
if module.get(b"name") == b"search":
|
||||
return True
|
||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
||||
except Exception:
|
||||
return False # handling older redis versions
|
||||
|
||||
@@ -66,11 +57,7 @@ def if_redisearch_enabled(function):
|
||||
|
||||
|
||||
def make_key(key):
|
||||
<<<<<<< HEAD
|
||||
return f"{frappe.conf.db_name}|{key}".encode()
|
||||
=======
|
||||
return frappe.cache().make_key(key)
|
||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
||||
|
||||
|
||||
@if_redisearch_enabled
|
||||
@@ -100,14 +87,8 @@ def create_website_items_index():
|
||||
|
||||
idx_fields = [to_search_field(f) for f in idx_fields]
|
||||
|
||||
<<<<<<< HEAD
|
||||
client.create_index(
|
||||
[TextField("web_item_name", sortable=True), *idx_fields],
|
||||
=======
|
||||
# TODO: sortable?
|
||||
index.create_index(
|
||||
[TextField("web_item_name", sortable=True)] + idx_fields,
|
||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
||||
[TextField("web_item_name", sortable=True), *idx_fields],
|
||||
definition=idx_def,
|
||||
)
|
||||
|
||||
@@ -202,16 +183,8 @@ def define_autocomplete_dictionary():
|
||||
@if_redisearch_enabled
|
||||
def create_items_autocomplete_dict():
|
||||
"Add items as suggestions in Autocompleter."
|
||||
<<<<<<< HEAD
|
||||
items = frappe.get_all("Website Item", fields=["web_item_name", "item_group"], filters={"published": 1})
|
||||
|
||||
=======
|
||||
|
||||
ac = frappe.cache().ft()
|
||||
items = frappe.get_all(
|
||||
"Website Item", fields=["web_item_name", "item_group"], filters={"published": 1}
|
||||
)
|
||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
||||
items = frappe.get_all("Website Item", fields=["web_item_name", "item_group"], filters={"published": 1})
|
||||
for item in items:
|
||||
ac.sugadd(WEBSITE_ITEM_NAME_AUTOCOMPLETE, Suggestion(item.web_item_name))
|
||||
|
||||
|
||||
@@ -89,21 +89,12 @@ def product_search(query, limit=10, fuzzy_search=True):
|
||||
|
||||
# TODO: Check perf/correctness with Suggestions & Query vs only Query
|
||||
# TODO: Use Levenshtein Distance in Query (max=3)
|
||||
<<<<<<< HEAD
|
||||
ac = AutoCompleter(make_key(WEBSITE_ITEM_NAME_AUTOCOMPLETE), conn=red)
|
||||
client = Client(make_key(WEBSITE_ITEM_INDEX), conn=red)
|
||||
suggestions = ac.get_suggestions(
|
||||
query,
|
||||
num=limit,
|
||||
fuzzy=fuzzy_search and len(query) > 3, # Fuzzy on length < 3 can be real slow
|
||||
=======
|
||||
redisearch = redis.ft(WEBSITE_ITEM_INDEX)
|
||||
suggestions = redisearch.sugget(
|
||||
WEBSITE_ITEM_NAME_AUTOCOMPLETE,
|
||||
query,
|
||||
num=limit,
|
||||
fuzzy=fuzzy_search and len(query) > 3,
|
||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
||||
)
|
||||
|
||||
# Build a query
|
||||
|
||||
@@ -12,12 +12,8 @@ dependencies = [
|
||||
"pycountry~=20.7.3",
|
||||
"python-stdnum~=1.16",
|
||||
"Unidecode~=1.2.0",
|
||||
<<<<<<< HEAD
|
||||
"redisearch~=2.1.0",
|
||||
"rapidfuzz~=2.15.0",
|
||||
"holidays~=0.28",
|
||||
=======
|
||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
||||
|
||||
# integration dependencies
|
||||
"gocardless-pro~=1.22.0",
|
||||
|
||||
Reference in New Issue
Block a user