×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Problem with Search

Problem with Search 7 years 9 months ago #35526

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
Hi,
Go to this page: goo.gl/GIbLuy

Then search for the term IT... And see what you will get. How to fix this problem? We have IT Security as name of company but it's way down in the list (page 3) when you search.

What is the solution?

Thanks

Problem with Search 7 years 9 months ago #35527

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Nikolay,

IT is a very short word and the search we do is not for 1:1 matches, but for words that can start, end and contain the string. That's why you get Villa road Suite there . Suite has it in it. If you want to have 1:1 match for words, then you'll have to hack the code that does the search query.

Is this what you want to do? However then you'll most probably run in another issue - if you have the word "something-it" then the query won't match. as it is part of the word.

So what do you want to do?

Regards,
Daniel

Problem with Search 7 years 9 months ago #35528

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
I want to fix the problem because if i search for IT Security is not showing the IT Security we have.

Problem with Search 7 years 9 months ago #35529

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
Or search only for Security... The first thing is Cyber Securty which is very strange... The whole search plugin is a mess... If this can't be fix we will look for other solution which sucks because i need to redo the whole system now

Problem with Search 7 years 9 months ago #35530

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
I want to have 1:1 match because our partners search for themselves. I want when someone search for IT Security this to be on the first position not on 6

Problem with Search 7 years 9 months ago #35534

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
When you will give me solution?

Problem with Search 7 years 9 months ago #35542

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
I'm still waiting for solution.

Problem with Search 7 years 9 months ago #35543

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Nikolay,
You'll have to hack the code in the following file:
components\com_hotspots\models\json.php

on line 426 you have this code till line 443:
you have this code:
$words = explode(' ', $sentence);
 
			foreach ($words as $word)
			{
				$searchWord = $q->Quote('%' . $q->escape($word, true) . '%', false);
				$search[] = $name . ' LIKE ' . $searchWord;
				$search[] = $description . ' LIKE ' . $searchWord;
				$search[] = $descriptionSmall . ' LIKE ' . $searchWord;
				$search[] = $plz . ' LIKE ' . $searchWord;
 
				if (count($cats))
				{
					$search[] = $catName . ' LIKE ' . $searchWord;
				}
 
				$search[] = $street . ' LIKE ' . $searchWord;
				$search[] = $country . ' LIKE ' . $searchWord;
				$search[] = $town . ' LIKE ' . $searchWord;
			}
change it to this
$words = explode(' ', $sentence);
 
			foreach ($words as $word)
			{
				$searchWord = $q->Quote('[[:<:]]' . $q->escape($word, true) . '[[:>:]]', false);
				$search[] = $name . ' RLIKE ' . $searchWord;
				$search[] = $description . ' RLIKE ' . $searchWord;
				$search[] = $descriptionSmall . ' RLIKE ' . $searchWord;
				$search[] = $plz . ' RLIKE ' . $searchWord;
 
				if (count($cats))
				{
					$search[] = $catName . ' RLIKE ' . $searchWord;
				}
 
				$search[] = $street . ' RLIKE ' . $searchWord;
				$search[] = $country . ' RLIKE ' . $searchWord;
				$search[] = $town . ' RLIKE ' . $searchWord;
			}
With this change you should be able to search for 1:1 match for words. Keep in mind that if you enter "Information technology" for search term, then you'll search for the full word "information" or "technology".

It would be really good if you do those changes in a hotspots plugin. We have a onAfterBuildQuery event that would give you the current query object. There you could strip the current where part of the query and do whatevery you want. This way even when you update hotspots your changes to the json.php file won't be overriden.

Regards,
Daniel

Problem with Search 7 years 9 months ago #35544

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
I did the changes

goo.gl/CugZUo

Go and search for IT Security... The first result is IT Academy

How to make this when i search for IT Security to show IT Security first?

Thanks

Problem with Search 7 years 9 months ago #35547

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Nikolay,

The default sorting is name asc, so what you see is correct. If you don't want to have IT Academy in the list at all when you do search for IT Security, then you have to change the first line
$words = explode(' ', $sentence);
to
$words = array($sentence);

This way "IT Security" won't be split in 2 words. You'll get way less results than now, but maybe it works better for your project.

Regards,
Daniel

Problem with Search 7 years 9 months ago #35562

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Everything working?

Problem with Search 7 years 9 months ago #35583

  • Nikolay Tsvetkov
  • Nikolay Tsvetkov's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 0
Yes. I think everything is working the way we want it

Thanks
  • Page:
  • 1
Time to create page: 0.120 seconds