Quick Search by Search Words

I have noticed that by generating the catalog for Quick Search that what it is basically doing is duplicating all of the information that you already have thus making the database twice as large.



One of the many fields it is duplicating is Search words. I have been using the Search words field since day one and have entered all of the relevant information that I think my customers may need in order to find what they want (manufacturer, product code, product name). That’s what this field is for correct? So what I have done is modified the addon to only catalog the search field which in return adds only about a 1/4th to the size of the database (this will vary depending on each users data) and also seems much quicker to respond to the search.



/addons/quick_search/func.php

	// Get all products information<br />
	while ($pos <= $count) {<br />
		[COLOR="Blue"]//[/COLOR]$products = db_get_array('SELECT descr.product_id, descr.product, descr.shortname, descr.short_description, descr.full_description, descr.meta_keywords, descr.meta_description, descr.search_words, descr.lang_code as lang_code, ?:products.product_code FROM ?:product_descriptions AS descr LEFT JOIN ?:products ON (descr.product_id = ?:products.product_id) WHERE 1 ' . $lang_condition . ' LIMIT ?i, ?i', $pos, SEARCH_LIMIT);<br />
		[COLOR="Blue"]$products = db_get_array('SELECT descr.product_id, descr.search_words, descr.lang_code as lang_code, ?:products.product_code FROM ?:product_descriptions AS descr LEFT JOIN ?:products ON (descr.product_id = ?:products.product_id) WHERE 1 ' . $lang_condition . ' LIMIT ?i, ?i', $pos, SEARCH_LIMIT);[/COLOR]<br />
		<br />
		$pos += SEARCH_LIMIT;<br />
		<br />
		if (!empty($products)) {<br />
			foreach ($products as $product) {<br />
				$product_id = $product['product_id'];<br />
				$lang_code = $product['lang_code'];<br />
				unset($product['product_id'], $product['lang_code']);<br />
				<br />
				foreach ($product as $field => $attr) {<br />
					if (!empty($attr)) {<br />
						($field == '[COLOR="Blue"]search_words[/COLOR]') ? $type = 't' : ($field == 'product_code' ? $type = 's' : $type = 'p');<br />
						<br />
						fn_quick_search_fill_data($product_id, $type, $lang_code, $attr);<br />
						<br />
						echo '.';<br />
					}<br />
				}<br />
			}<br />
			<br />
			echo '<br />';<br />
		}<br />
	}

I have an issue with search words. If in my search bar I enter “pink butterfly”, it will only return an item if “pink” and “butterfly” are right next to each other in the search words on the admin side. So if on the back end I have



pink, nylon, butterfly





the product will not return. My search setting is on “any”



any thoughts on this? I can’t possibly enter all combinations that my customers will think of.

[quote name=‘moka’]I have an issue with search words. If in my search bar I enter “pink butterfly”, it will only return an item if “pink” and “butterfly” are right next to each other in the search words on the admin side. So if on the back end I have



pink, nylon, butterfly





the product will not return. My search setting is on “any”



any thoughts on this? I can’t possibly enter all combinations that my customers will think of.[/QUOTE]



I agree! i am looking for a solution to this problem as well!

Please please somebody help!