Jump to content

Improving search functionality


Recommended Posts

Hi, 

 

I searched for the relavant topic but couldnt find it. 

 

Is it possible to improve the search functionality, its very common in most of the sites but not in my shop. 

 

When I searched the word "clock", its showing all proper results from "Wall clocks" category. 

 

When I search 'King" it is getting a result from "Wall stickers" category. 

 

However, when I search for 'King Clock" it shows 0 results. It is supposed to show both of the above results combined. 

 

How to improve the functionality to search based on any word rather than complete string. 

 

Can anyone point me in right direction. 

 

My shop URL: omytus.com

 

Thank you for any suggestion. 

 

PrestaFanBoy.

Link to comment
Share on other sites

Hi, 

 

I searched for the relavant topic but couldnt find it. 

 

Is it possible to improve the search functionality, its very common in most of the sites but not in my shop. 

 

When I searched the word "clock", its showing all proper results from "Wall clocks" category. 

 

When I search 'King" it is getting a result from "Wall stickers" category. 

 

However, when I search for 'King Clock" it shows 0 results. It is supposed to show both of the above results combined. 

 

How to improve the functionality to search based on any word rather than complete string. 

 

Can anyone point me in right direction. 

 

My shop URL: omytus.com

 

Thank you for any suggestion. 

 

PrestaFanBoy.

 

 

Hi, 

 

I would appreciate if anyone can help me in this aspect..

 

Thank you very much. 

 

PrestaFanBoy

Link to comment
Share on other sites

I think you need to edit the Find method of the Search class.

 

I haven't tested it, but this might be a clue. At about line 237 you have

		foreach ($intersect_array as $query)
		{
			$eligible_products2 = array();
			foreach ($db->executeS($query) as $row)
				$eligible_products2[] = $row['id_product'];

			$eligible_products = array_intersect($eligible_products, $eligible_products2);
			if (!count($eligible_products))
				return ($ajax ? array() : array('total' => 0, 'result' => array()));
		}

As you can see, it's intersecting the result of each keyword result. This means only products matching all keywords are eligible. try changing this, perhaps using array_merge! :)

  • Like 1
Link to comment
Share on other sites

I think you need to edit the Find method of the Search class.

 

I haven't tested it, but this might be a clue. At about line 237 you have

		foreach ($intersect_array as $query)
		{
			$eligible_products2 = array();
			foreach ($db->executeS($query) as $row)
				$eligible_products2[] = $row['id_product'];

			$eligible_products = array_intersect($eligible_products, $eligible_products2);
			if (!count($eligible_products))
				return ($ajax ? array() : array('total' => 0, 'result' => array()));
		}

As you can see, it's intersecting the result of each keyword result. This means only products matching all keywords are eligible. try changing this, perhaps using array_merge! :)

 

 

Thank you Nemo1 for your reply. 

 

I will try to play with it:)

 

PrestaFanBoy

Link to comment
Share on other sites

  • 3 months later...
  • 9 months later...

Did this solution work, PrestaFanBoy? I'm interested too in improving the search functionality.

Yup , it does work but am not sure about the quality of search. earlier on entering a a invalid keyword i received 0 result even when relevant keywords where present in the search string.

 

now  I get abundant results while few being relevant

 i guess its a trade off worth making, some thing better than nothing

  • Like 1
Link to comment
Share on other sites

I think you need to edit the Find method of the Search class.

 

I haven't tested it, but this might be a clue. At about line 237 you have

		foreach ($intersect_array as $query)
		{
			$eligible_products2 = array();
			foreach ($db->executeS($query) as $row)
				$eligible_products2[] = $row['id_product'];

			$eligible_products = array_intersect($eligible_products, $eligible_products2);
			if (!count($eligible_products))
				return ($ajax ? array() : array('total' => 0, 'result' => array()));
		}

As you can see, it's intersecting the result of each keyword result. This means only products matching all keywords are eligible. try changing this, perhaps using array_merge! :)

Thank you so much, If there are any other fixes/patches possible please let us know. Would be happy to test/try them.

Link to comment
Share on other sites

×
×
  • Create New...