VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: EvanGR on March 09, 2020, 10:42:00 AM

Title: Tweaking the VM Search functions
Post by: EvanGR on March 09, 2020, 10:42:00 AM
Hello,

We want to do some custom tweaks to the VM Search logic. Which file(s) do we need to look for?

Thanks
Title: Re: Tweaking the VM Search functions
Post by: GJC Web Design on March 09, 2020, 10:55:29 AM
administrator\components\com_virtuemart\models\product.php

function sortSearchListQuery()

there is a plugin trigger @ line 773

      if ($this->searchplugin !== 0) {
         JPluginHelper::importPlugin('vmcustom');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('plgVmBeforeProductSearch', array(&$select, &$joinedTables, &$where, &$groupBy, &$orderBy,&$joinLang));
      }
Title: Re: Tweaking the VM Search functions
Post by: EvanGR on March 09, 2020, 11:24:46 AM
Thank you.

I want to alter the user typed keywords, to catch some common errors or replace search terms.

e.g.
User types: "buble"
Search for: "bubble" or "baloon"

Any idea which part of the function holds the typed in keywords?

Thanks
Title: Re: Tweaking the VM Search functions
Post by: pinochico on March 09, 2020, 12:10:06 PM
Nice idea :)

If You find solution, pls type here, I need too.

Thanks
Title: Re: Tweaking the VM Search functions
Post by: GJC Web Design on March 09, 2020, 19:16:53 PM
perhaps a multi-server AI installation that knows what you mean even before u do and will return the results just by you thinking of a key word....

hint :  keyword
Title: Re: Tweaking the VM Search functions
Post by: PRO on March 10, 2020, 16:38:18 PM
Quote from: EvanGR on March 09, 2020, 11:24:46 AM
Thank you.

I want to alter the user typed keywords, to catch some common errors or replace search terms.

e.g.
User types: "buble"
Search for: "bubble" or "baloon"

Any idea which part of the function holds the typed in keywords?

Thanks


I would keep the data in a separate table.

Then check keyword in URL and redirect.

Title: Re: Tweaking the VM Search functions
Post by: Studio 42 on March 10, 2020, 18:42:04 PM
Quote from: PRO on March 10, 2020, 16:38:18 PM
Quote from: EvanGR on March 09, 2020, 11:24:46 AM
Thank you.

I want to alter the user typed keywords, to catch some common errors or replace search terms.

e.g.
User types: "buble"
Search for: "bubble" or "baloon"

Any idea which part of the function holds the typed in keywords?

Thanks


I would keep the data in a separate table.

Then check keyword in URL and redirect.


why note using synonym dictionary? But this can be very slow and need to be adjusted by shop, so can be a nightmare and need one per language.
Another option, but for a really big shop, is to check the most searched word combination.But this need to have plenty of search.
Title: Re: Tweaking the VM Search functions
Post by: EvanGR on March 11, 2020, 09:06:21 AM
URL Redirects may be a much slower option, than simple keyword translation in the search code.