looking for simple code to build a search engine

M

Marcel

Hi,
I have a hobby website with many, many pages with pictures on which I want
to install a search engine. The ones I've had a look at don't exactly do
what I want. So I want to make it myself. On the other hand, I'm completely
new to Perl - it does work fine on my computer though.
My idea is as follows:
any search on my website looks into a file (search.txt) of which each line
looks something like "url= .... thumb= ... title= .... keywords= ...".
The keywords-part (of course) must be scanned, and if a match is found, then
the title, url and thumbnail must be returned to the search page.
The search.txt is fed by my pictures database.
Is there something out there that I can use?
Many thanks,
Marcel
 
A

Alan Mead

looks something like "url= .... thumb= ... title= .... keywords= ...".
The keywords-part (of course) must be scanned, and if a match is found,
then the title, url and thumbnail must be returned to the search page.

You'll get your hand slapped if you ask CGI question here that really have
nothing to do with Perl. Try comp.infosystems.www.authoring.cgi for those
sorts of questions but feel free to ask about PERL stuff here.

But here is some Perl advice: You'll be re-inventing a fair bit of
wheel... not that you would be the first Perl hacker to do so....

But I wouldn't re-invent the database part. Look into dbm or an SQL
database. dbm is simpler. It's like a hash on disk. I would use two dbm
files. First, store your url+thumb+title in one with some sort of unique
key (it could be a sequential number). Then store each keyword with the
unique key in a second dbm file. You would have to code the search to
open the second file, find the unique keys of the matching keywords and
then open the first file to retrieve those records by the unique keys.

But this is clearly a tuple relationship where the unique key to your
pictures is the foreign key to the second table (or.. I reversed them).
I'm sure you would be better off using a good SQL engine which adds the
possibility of doing 'LIKE %keyword%' searches. Of course, you need to
learn some SQL. There are lots of good RDBMS for those level of use...
MySQL is very popular. You could also use SQLite or something similar if
you don't want to get into (or cannot) install something weighty.

Don't store your thumbnails in the database, just store the path to the
file.

-Alan
 
J

James Willmore

I have a hobby website with many, many pages with pictures on which I
want to install a search engine. The ones I've had a look at don't
exactly do what I want. So I want to make it myself. On the other hand,
I'm completely new to Perl - it does work fine on my computer though. My
idea is as follows:
any search on my website looks into a file (search.txt) of which each
line looks something like "url= .... thumb= ... title= .... keywords=
...". The keywords-part (of course) must be scanned, and if a match is
found, then the title, url and thumbnail must be returned to the search
page. The search.txt is fed by my pictures database. Is there something
out there that I can use?

Try searching Freshmeat (http://freshmeat.net/). There are scripts there
that will do exactly (or, at least, similar) to what you want to do.

Or, use Google :)

HTH

Jim
 
T

Tad McClellan

Alan Mead said:
feel free to ask about PERL stuff here.


That would be "Perl stuff", not "PERL stuff".

The name of the language is not an acronym (the Perl FAQ says so).
 
G

Gregory Toomey

Marcel said:
Hi,
I have a hobby website with many, many pages with pictures on which I want
to install a search engine. The ones I've had a look at don't exactly do
what I want. So I want to make it myself. On the other hand, I'm
completely new to Perl - it does work fine on my computer though.
My idea is as follows:
any search on my website looks into a file (search.txt) of which each line
looks something like "url= .... thumb= ... title= .... keywords= ...".
The keywords-part (of course) must be scanned, and if a match is found,
then the title, url and thumbnail must be returned to the search page.
The search.txt is fed by my pictures database.
Is there something out there that I can use?
Many thanks,
Marcel


For Perl search engines for a single website look at

http://www.htdig.org/ (I use this myself)
http://swish-e.org/
http://www.xav.com/scripts/search/ (used this in the past)

gtoomey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top