RE: [PHP] searching and sorting
| From: | Michael Sims | Date: | Wed, 19 Jan 2005 02:58:12 +0000 |
| Subject: | RE: [PHP] searching and sorting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206723@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
> Brian A. Anderson wrote:
[...]
>> I am thinking of incrementally adding the resultant hits into two
>> associative arrays with the link to the data and a calculated
>> relevance value, and sorting this array by these relevences.
[...]
> One Axiom: Keep as much of the scoring/sorting in your SQL as
> possible -- That's what SQL engines are best at.
I suggest the original poster look into some of the full text indexing
capabilities of his SQL server. A lot of these (for PostgreSQL and MySQL
anyway) will automatically return a relevance value and handle sorting based
on that. As you said, that'll be a heck of a lot more efficient and easier
to implement that doing it in PHP.