Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have written a similar search to the one you describe, this is the approach I took.

1. build an indexer which takes all the words used in the search and put them into a table with these columns.

word, record_id, word_count, word_in_title

word == the word itself
record_id == where the word points to
word_count == frequency of word in document
word_in_title == does word exist in title

searching for terms than goes like this( notice that I only put the % at the end of the like so it will still use an index! )

select record_id, sum(word_count), max(word_in_title) from TABLE where word like '$word%' group by record_id

if the user searches for multiple words than run the above statement multiple times and sum them up by record_id.

Spit them back out by the max word_count.

My example site: www.historychannel.com ( does no caching of results, still very quick )


In reply to Re: Database searches with persistent results via CGI by Anonymous Monk
in thread Database searches with persistent results via CGI by MrCromeDome

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found