search engine

What is the most cost effective way of adding a search engine to my website?

 I am aware that there are  free ones available, but they tend to
contain a link to the site they came from, or the search results are  displayed on their site. This of course means that the whole colour  scheme of your site changes to theirs on the results page.

I don't mind paying a small amount  for a system.

                                    Any ideas


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this:

                                 my($searchdir) = "yourdir/yoursubdir";

                                 # for top/bottom files....
                                 my($htmldir) = "yourdir/htmlpages";

                                 my($word) = param('keyword');

                                 opendir DIR, $searchdir;
                                 my(@files) = readdir DIR;

                                 foreach my $file (@files) {
                                  next if $file =~ m!^\.{1,2}!;
                                  next if -d "$searchdir/$file";
                                  open (FILE, "$searchdir/$file");
                                  my(@lines) = <FILE>;
                                  close FILE;
                                  foreach my $line (@lines) {
                                 # remove last i for case sensitive search.
                                   if ($line =~ m!$word!i) {
                                    push (@matches, $file);

                                 # Matching files are now stored in @matches

                                 my($number_of_matches) = @matches;
                                 my($matchno); #counter

                                 foreach my $match (@matches) {
                                 # Modify after the next line to customize each match-line.
                                  push (@output_lines, <<__END_HTML__);
                                 $matchno. <A HREF="$match">$match</A><BR>


                                 # Looks for top.html and bottom.html. Modify these to change the output.
                                 open (FILE, "$htmldir/top.html");
                                 print <FILE>;
                                 close FILE;

                                 print @output_lines;

                                 open (FILE, "$htmldir/bottom.html");
                                 print <FILE>;
                                 close FILE;
Ooops, forgot

use CGI qw(:standard);

at the start....
alex_harrisAuthor Commented:

Thanks for the reply how exactly do I use this script on a UNIX server?
You paste it into a file, store it in your CGI-bin directory and set the proper permissions (don't know Unix so someone else might help you on the correct/best chmod-numbers).

That should be it. The script is not tested but should work, though. Tell me if you have problems.

allows you to do what you want (including results formatting and reporting)...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.