I was having problems with my Actinic Catalog Version 7 site when search words were plurals (or not as the case may be) in that the search results did not bring up all relevant results, so I searched for a solution and found the solution below:-
_______________________________________
How can I match plurals in the search?
Sometimes if you have the word 'apples' in your product description, you want people to be able to find that product if they search for the word 'apple' (without the 's'). This little addition to the Perl script will take care of that.
Open 'Search.pm' (from within your site directory) in Notepad or a similar editor.
Find the line:
# Combine any multiple-white-spaces into single space
Place the following lines just above that line:
$$psSearchString =~ s/es$//io;
$$psSearchString =~ s/s$//io;
$$psSearchString =~ s/es\b//io;
$$psSearchString =~ s/s\b//io;
____________________________________
HOWEVER, this seems to be for a later version of Actinic catalog. So I opened the perlscript in version 7 site folder and found the following:-
___________________________________
#
# trim excess leading and trailing white space
#
$sSearchValue =~ s/^\s*//o;
$sSearchValue =~ s/\s*$//o;
#
_____________________________________
I then took the code from the other solution and adjusted it and inserted the 4 lines above the existing lines as so (using basic text editor):-
_____________________________________
#
# trim excess leading and trailing white space
#
$sSearchValue =~ s/es$//io;
$sSearchValue =~ s/s$//io;
$sSearchValue =~ s/es\b//io;
$sSearchValue =~ s/s\b//io;
$sSearchValue =~ s/^\s*//o;
$sSearchValue =~ s/\s*$//o;
#
______________________________________
I saved the file and updated the site and....hey it all seems to work ok, no more missed products because someone searched for 'guitar' instead of 'guitars' etc.
I'm sure there are coders out there who could improve this or may say woa you can't put that there, but hey it works for me so I'm happy
Hope this is of use to someone.
_______________________________________
How can I match plurals in the search?
Sometimes if you have the word 'apples' in your product description, you want people to be able to find that product if they search for the word 'apple' (without the 's'). This little addition to the Perl script will take care of that.
Open 'Search.pm' (from within your site directory) in Notepad or a similar editor.
Find the line:
# Combine any multiple-white-spaces into single space
Place the following lines just above that line:
$$psSearchString =~ s/es$//io;
$$psSearchString =~ s/s$//io;
$$psSearchString =~ s/es\b//io;
$$psSearchString =~ s/s\b//io;
____________________________________
HOWEVER, this seems to be for a later version of Actinic catalog. So I opened the perlscript in version 7 site folder and found the following:-
___________________________________
#
# trim excess leading and trailing white space
#
$sSearchValue =~ s/^\s*//o;
$sSearchValue =~ s/\s*$//o;
#
_____________________________________
I then took the code from the other solution and adjusted it and inserted the 4 lines above the existing lines as so (using basic text editor):-
_____________________________________
#
# trim excess leading and trailing white space
#
$sSearchValue =~ s/es$//io;
$sSearchValue =~ s/s$//io;
$sSearchValue =~ s/es\b//io;
$sSearchValue =~ s/s\b//io;
$sSearchValue =~ s/^\s*//o;
$sSearchValue =~ s/\s*$//o;
#
______________________________________
I saved the file and updated the site and....hey it all seems to work ok, no more missed products because someone searched for 'guitar' instead of 'guitars' etc.
I'm sure there are coders out there who could improve this or may say woa you can't put that there, but hey it works for me so I'm happy
Hope this is of use to someone.
Comment