search engine! 
Author Message
 search engine!

Hi,

I am trying to write a search engine for our intranet web server using
perl.
Any pointer/freeware/shareware  info appreciated.

TIA
Sriram



Sat, 27 Oct 2001 03:00:00 GMT  
 search engine!
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]


Quote:
> I am trying to write a search engine for our intranet web server using
> perl.
> Any pointer/freeware/shareware  info appreciated.

#!/usr/bin/perl

use CGI_Lite; #(Or the standard CGI.pm module, your choice)
use File::Find;
use File::Slurp;

# things to do.
# 1 output your header
# 2 check for errors in the CGI input
# 3 put your keywords in an array
# 3 feed find a path, let it descend the directories
# 4 slurp the file into a scalar while taking out
#   the newlines and extra whitespace s/\s+/ /g
# 6 do a m// (ig optional) for your keywords
#   against the slurped scalar in a foreach loop
# 7 report your output

That's a basic framework with very little error checking if you wish to
DIY. I have yet to find one decent freeware/shareware search script out
there. They are either mangled Perl/C-ish code, or bloated scripts full
of all kinds of problems.

The benefit of a DIY project is it's *your* code and you'll have a better
grasp on it when you are ready to add features to it. Further, nothing in
a script like this is beyond the scope presented in something like
"Learning Perl" or the fundamentals of using the Perl language which can
be found in the bundled documentation.

When using the Perl modules, a fairly effective search script that you
can easily understand and later modify can be done in less than 30 lines
of code (most of the folks here could probably do it in 10).

It gets a little hairy if you want to get into search options, but if you
are using 5.005, you can include the Text::Query::Advanced module and get
full 'AltaVista Style' boolean searches at the drop of a hat.

-------
Charles "Vila" Thompson
RainCloud Studios
"That? That's no script. That's your attempt at a rather complex README
file."



Sat, 27 Oct 2001 03:00:00 GMT  
 search engine!
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]


eh...

Quote:
> #!/usr/bin/perl

#!/usr/bin/perl -w

use strict;

Quote:
> use CGI_Lite; #(Or the standard CGI.pm module, your choice)
> use File::Find;
> use File::Slurp;

Hehe.... was a quick email... too quick.

--
Charles R. Thompson
RainCloud Studios
"That? That's no script. That's your attempt at a rather complex README
file."



Sat, 27 Oct 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How-To search engine on search engines/mlml

2. ANNOUNCE: WWW::Search 1.009 available (web-search-engine API for Perl)

3. Searching Multible Search Engines Script

4. Multi search engine search on NT

5. Searching a search-engine script

6. ANNOUNCE: WWW::Search 1.007 available (web-search-engine API for Perl)

7. ANNOUNCE: WWW::Search 1.005 available (web-search-engine API for Perl)

8. ANNOUNCE: WWW::Search, a Perl API for web search engines

9. Searching Multible Search Engines Script

10. Remote Search Engine Results

11. Programmatically Controlling Remote Search Engines and Consolidating Results

12. Search Engine for Windows Shares

 

 
Powered by phpBB® Forum Software