mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +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():
|
def is_search_module_loaded():
|
||||||
try:
|
try:
|
||||||
cache = frappe.cache()
|
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():
|
for module in cache.module_list():
|
||||||
if module.get(b"name") == b"search":
|
if module.get(b"name") == b"search":
|
||||||
return True
|
return True
|
||||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return False # handling older redis versions
|
return False # handling older redis versions
|
||||||
|
|
||||||
@@ -66,11 +57,7 @@ def if_redisearch_enabled(function):
|
|||||||
|
|
||||||
|
|
||||||
def make_key(key):
|
def make_key(key):
|
||||||
<<<<<<< HEAD
|
|
||||||
return f"{frappe.conf.db_name}|{key}".encode()
|
|
||||||
=======
|
|
||||||
return frappe.cache().make_key(key)
|
return frappe.cache().make_key(key)
|
||||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
|
||||||
|
|
||||||
|
|
||||||
@if_redisearch_enabled
|
@if_redisearch_enabled
|
||||||
@@ -100,14 +87,8 @@ def create_website_items_index():
|
|||||||
|
|
||||||
idx_fields = [to_search_field(f) for f in idx_fields]
|
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(
|
index.create_index(
|
||||||
[TextField("web_item_name", sortable=True)] + idx_fields,
|
[TextField("web_item_name", sortable=True), *idx_fields],
|
||||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
|
||||||
definition=idx_def,
|
definition=idx_def,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -202,16 +183,8 @@ def define_autocomplete_dictionary():
|
|||||||
@if_redisearch_enabled
|
@if_redisearch_enabled
|
||||||
def create_items_autocomplete_dict():
|
def create_items_autocomplete_dict():
|
||||||
"Add items as suggestions in Autocompleter."
|
"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()
|
ac = frappe.cache().ft()
|
||||||
items = frappe.get_all(
|
items = frappe.get_all("Website Item", fields=["web_item_name", "item_group"], filters={"published": 1})
|
||||||
"Website Item", fields=["web_item_name", "item_group"], filters={"published": 1}
|
|
||||||
)
|
|
||||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
|
||||||
for item in items:
|
for item in items:
|
||||||
ac.sugadd(WEBSITE_ITEM_NAME_AUTOCOMPLETE, Suggestion(item.web_item_name))
|
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: Check perf/correctness with Suggestions & Query vs only Query
|
||||||
# TODO: Use Levenshtein Distance in Query (max=3)
|
# 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)
|
redisearch = redis.ft(WEBSITE_ITEM_INDEX)
|
||||||
suggestions = redisearch.sugget(
|
suggestions = redisearch.sugget(
|
||||||
WEBSITE_ITEM_NAME_AUTOCOMPLETE,
|
WEBSITE_ITEM_NAME_AUTOCOMPLETE,
|
||||||
query,
|
query,
|
||||||
num=limit,
|
num=limit,
|
||||||
fuzzy=fuzzy_search and len(query) > 3,
|
fuzzy=fuzzy_search and len(query) > 3,
|
||||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Build a query
|
# Build a query
|
||||||
|
|||||||
@@ -12,12 +12,8 @@ dependencies = [
|
|||||||
"pycountry~=20.7.3",
|
"pycountry~=20.7.3",
|
||||||
"python-stdnum~=1.16",
|
"python-stdnum~=1.16",
|
||||||
"Unidecode~=1.2.0",
|
"Unidecode~=1.2.0",
|
||||||
<<<<<<< HEAD
|
|
||||||
"redisearch~=2.1.0",
|
|
||||||
"rapidfuzz~=2.15.0",
|
"rapidfuzz~=2.15.0",
|
||||||
"holidays~=0.28",
|
"holidays~=0.28",
|
||||||
=======
|
|
||||||
>>>>>>> 4a38ce659d (refactor!: drop redisearch)
|
|
||||||
|
|
||||||
# integration dependencies
|
# integration dependencies
|
||||||
"gocardless-pro~=1.22.0",
|
"gocardless-pro~=1.22.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user