looking for simple code to build a search engine

Discussion in 'Perl Misc' started by Marcel, Nov 30, 2004.

  1. Marcel

    Marcel Guest

    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
     
    Marcel, Nov 30, 2004
    #1
    1. Advertising

  2. Marcel

    Alan Mead Guest

    On Tue, 30 Nov 2004 09:47:37 +0000, Marcel wrote:

    > 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
     
    Alan Mead, Nov 30, 2004
    #2
    1. Advertising

  3. On Tue, 30 Nov 2004 09:47:37 +0000, Marcel wrote:

    > 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
     
    James Willmore, Nov 30, 2004
    #3
  4. Alan Mead <> wrote:

    > 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).


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Nov 30, 2004
    #4
  5. Marcel

    Alan Mead Guest

    On Tue, 30 Nov 2004 12:03:21 -0600, Tad McClellan wrote:

    > Alan Mead <> wrote:
    >
    >> 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).


    That would be SHOUTING :)

    -Alan
     
    Alan Mead, Nov 30, 2004
    #5
  6. Marcel wrote:

    > 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
     
    Gregory Toomey, Dec 1, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sasha
    Replies:
    3
    Views:
    606
    Sasha
    May 22, 2007
  2. pandi
    Replies:
    5
    Views:
    461
    pandi
    Dec 14, 2009
  3. Abby Lee
    Replies:
    5
    Views:
    443
    Abby Lee
    Aug 2, 2004
  4. Public Interest

    Looking for a search engine submit script

    Public Interest, Oct 6, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    139
    Tad McClellan
    Oct 6, 2003
  5. Robin
    Replies:
    21
    Views:
    329
    Joe Smith
    May 3, 2004
Loading...

Share This Page