feat: Basic Query + Autocomplete
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index 76b007a..010e7a6 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -11,7 +11,12 @@
 
 # For SEARCH -------
 import redis
-from redisearch import Client, AutoCompleter, Suggestion, IndexDefinition, TextField, TagField
+from redisearch import (
+	Client, AutoCompleter, Query,
+	Suggestion, IndexDefinition, 
+	TextField, TagField,
+	Document
+	)
 
 WEBSITE_ITEM_INDEX = 'website_items_index'
 WEBSITE_ITEM_KEY_PREFIX = 'website_item:'
@@ -62,21 +67,46 @@
 
 @frappe.whitelist(allow_guest=True)
 def search(query):
+	if not query:
+		# TODO: return top/recent searches
+		return []
+
 	ac = AutoCompleter(WEBSITE_ITEM_NAME_AUTOCOMPLETE, port=13000)
+	client = Client(WEBSITE_ITEM_INDEX, port=13000)
 	suggestions = ac.get_suggestions(query, num=10)
-	print(suggestions)
-	return list([s.string for s in suggestions])
+
+	# Build a query
+	query_string = query
+
+	for s in suggestions:
+		query_string += f"|({s.string})"
+
+	q = Query(query_string)
+
+	print(f"Executing query: {q.query_string()}")
+
+	results = client.search(q)
+	results = list(map(convert_to_dict, results.docs))
+
+	print("SEARCH RESULTS ------------------\n ", results)
+
+	return results
+
+def convert_to_dict(redis_search_doc):
+	return redis_search_doc.__dict__
 
 def create_website_items_index():
 	'''Creates Index Definition'''
+	# CREATE index
+	client = Client(WEBSITE_ITEM_INDEX, port=13000)
+
 	# DROP if already exists
 	try:
 		client.drop_index()
 	except:
 		pass
 
-	# CREATE index
-	client = Client(WEBSITE_ITEM_INDEX, port=13000)
+	
 	idx_def = IndexDefinition([WEBSITE_ITEM_KEY_PREFIX])
 
 	client.create_index(
@@ -92,11 +122,11 @@
 	r = redis.Redis("localhost", 13000)
 	web_item = create_web_item_map(website_item_doc)
 	r.hset(key, mapping=web_item)
-	insert_to_name_ac(website_item_doc.name)
+	insert_to_name_ac(website_item_doc.web_item_name, website_item_doc.name)
 
-def insert_to_name_ac(name):
+def insert_to_name_ac(web_name, doc_name):
 	ac = AutoCompleter(WEBSITE_ITEM_NAME_AUTOCOMPLETE, port=13000)
-	ac.add_suggestions(Suggestion(name))
+	ac.add_suggestions(Suggestion(web_name, payload=doc_name))
 
 def create_web_item_map(website_item_doc):
 	web_item = {}
@@ -169,5 +199,6 @@
 	return f"{WEBSITE_ITEM_KEY_PREFIX}{name}"
 
 # TODO: Remove later
+# Figure out a way to run this at startup
 define_autocomplete_dictionary()
 create_website_items_index()
diff --git a/erpnext/www/all-products/search.css b/erpnext/www/all-products/search.css
new file mode 100644
index 0000000..ff0ca6a
--- /dev/null
+++ b/erpnext/www/all-products/search.css
@@ -0,0 +1,5 @@
+.item-thumb {
+    height: 50px;
+    width: 50px;
+    object-fit: cover;
+}
\ No newline at end of file
diff --git a/erpnext/www/all-products/search.html b/erpnext/www/all-products/search.html
index e7d437a..ef74536 100644
--- a/erpnext/www/all-products/search.html
+++ b/erpnext/www/all-products/search.html
@@ -1,7 +1,11 @@
 {% extends "templates/web.html" %}
 
-
 {% block title %}{{ _('Search') }}{% endblock %}
+
+{%- block head_include %}
+	<link rel="stylesheet" href="search.css">
+{% endblock -%}
+
 {% block header %}
 <div class="mb-6">{{ _('Search Products') }}</div>
 {% endblock header %}
diff --git a/erpnext/www/all-products/search.js b/erpnext/www/all-products/search.js
index 02678a2..2080f35 100644
--- a/erpnext/www/all-products/search.js
+++ b/erpnext/www/all-products/search.js
@@ -1,12 +1,16 @@
-console.log("search.js loaded");
+console.log("search.js reloaded");
 
 const search_box = document.getElementById("search-box");
 const results = document.getElementById("results");
 
 function populateResults(data) {
+    console.log(data);
     html = ""
     for (let res of data.message) {
-        html += `<li>${res}</li>`
+        html += `<li>
+        <img class="item-thumb" src="${res.thumbnail || ''}" />
+        <a href="/${res.route}">${res.web_item_name}</a>
+        </li>`
     }
     console.log(html);
     results.innerHTML = html;