Re: Re: New search related question
| From: | Robert Cummings | Date: | Mon, 04 Feb 2008 20:19:29 +0000 |
| Subject: | Re: Re: New search related question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268667@lists.php.net to get a copy of this message | ||
On Mon, 2008-02-04 at 14:13 -0600, Shawn McKenzie wrote:
> If there aren't many files and you don't intend to grow this site much
> larger and intend to always have static HTML, any easy implementation
> would be to read each file and search for the terms either in the
> keywords tag or in the entire file.
>
> Optionally, if you're on a *nix host you could exec() a grep for the
> terms which returns the matching lines in an array and display as needed.
Wow, that has got to be the most inefficient lazy method I've ever
heard. I would never suggest such a route on a production server. His
original plan is much more efficient and is generally along the lines
how how search indexing works. As such for a simple site I'd do what he
suggest using a FULLTEXT field in the database, or as Greg Donal
suggested, use soemthing like htdig. A more involved solution would be
something like Lucene. Either way, you don't want to be scanning the
files on ever search request.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'