Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

  (email not shown publicly)

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm :,,
lug : Devon & Cornwall LUG
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl []
flickr :hashbangperl []

Journal of TeeJay (2309)

Monday October 04, 2004
04:36 AM

Just write a simple reverse index

[ #21176 ]
Heard any good strategies for super-fast catalog-database search results?

Yes - just write a simple or weighted reverse index. Its trivial in any relational database and works accross tables and can be weighted by key columns or object attributes.

Don't use native RDBMS or SQL like unless you want your site to be as unsearchable as the millions of others out there.

Which reminds me -, and many perl sites (including search.cpan and still have sucky searches - who else is interested in getting together and trying to improve them?

I am planning to port my current searchable class to Class::DBI, which might help. I will probably look at a module to provide a similar functionality in a procedural way to non-OO code.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I'm interested in improvements to; I'm exploring ways to improve the searching and findability of articles across the entire O'Reilly Network. Please feel free to send me ideas.

    • see my response on the blog - I couldn't even find my article on searching through, found it straight away with google.

      It would be nice if could showcase good perl solutions.

      If I knew what was using I would be happy to make suggestions.


      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;
    http://search.cpan.o rg/~tmtm/Class-DBI-mysql-FullTextSearch-0.09/ Search-InvertedIndex-1.14/

    I used the last one with good results.
    life is short
    • Yup the last one is a reverse index. They work nicely and are trivial to write and customise.

      I wrote a handy class that implements cross-object context specific searching - Class-Indexed-0.01 []

      Its based on the article I wrote for

      The others aren't a solution - native RDBMS fulltext searching is only useful for really trivial cases - if your data is only in a single table and has a very simple structure so you are only interested in 1 or 2 columns and they don't change - move beyond that and nati


      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;
      • It depends on how the database implements the full text search. Often it is just a reverse index under the covers, with some stemming and phrase support bolted on.

        I agree that a reverse index is typically the way to go for custom searching. It scales well and is very customizable.

        • I have yet to see an RDBMS native fulltext search that is as good as a handwritten one - all are held back by a total lack of customisation or weighting and can only apply to a single table. Very few provide features like stemming although they can provide some simple phrase matching and global weightings (i.e. common words may score less, etc).

          As I said, even a good native RDBMS can be improved on trivially with a competent custom reverse index, as stemming, etc are trivial in perl. Native RDBMS are only


          @JAPH = qw(Hacker Perl Another Just);
          print reverse @JAPH;