Afternoon

How to get a limited number of rows of results back varies from database to database. You didn't mention which database you're using, but in MySQL, for example, the syntax is:

SELECT * FROM foo LIMIT 5, 10;

This would fetch 10 rows, starting from the 5th row. If you're not using MySQL, you'll need to have a quick search, as I can't remember Oracle or Pg off the top of my head.

To make searching any reasonably big corpus of data acceptably fast, you probably need to make use of an index; which is a table of words and phrases matched to the documents that contain them. Looking through every word of every document for every search is just too sloooooow. Take a look at this recent article on perl.com for more info if you're interested in writing your own search engine from scratch in perl.

Alternatively, since writing a search engine is a complicated (though very interesting) exercise, consider using a ready-to-go free search engine that you can install and use on your server, for example Swish-E (perl) or htDig (not perl). I've used the latter with fairly satisfying results.

Lastly, have a search round the monastery, as this kind of thing has been discussed on a few occasions before.

update: added answer to the obvious question at the top. stupid me.

cheers
ViceRaid


In reply to Re: Inefficient search algorithm? by ViceRaid
in thread Inefficient search algorithm? by ruhk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.