Are you using FULLTEXT indexes on the search coloumns? They will sort
results according to relevance (depending upon the algorithm, that might not
be what you want).
It will index most of the relevant words in your column (which should be a
TEXT or a VARCHAR field) and then search on those words.

----- Original Message -----
From: "Nick Boldt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 12:49 PM
Subject: Sort search results by relevance


> I have created a search page which shows all records from a table that
> include one or more words of the search string.  Is there a way I can
> have MySQL sort the results according to relevance, and only display
> each recordset once?
>
> I am using ASP with IIS 5
>
>   txtSearch = Request("txtSearch")
>   arrSearch = split(txtSearch, " ")
>   tmpSearch = ""
>   For x = 0 To UBound(arrSearch)
>     If x <> 0 Then
>   tmpSearch = tmpSearch & "or "
> End If
>     tmpSearch = tmpSearch & "us_desc LIKE '%"& arrSearch(x) &"%'"
>   Next
>
>   searchString = "SELECT * FROM consign WHERE consign_num =
> '"&prodRs("consign_num")&"' AND ("& tmpSearch &") ORDER BY consign_num
> ASC"
>
> Thanks in advance for any help you can provide.
>
> Sincerely,
>
> Nick Boldt
> Computer Network Administrator
> Track of the Wolf
> Elk River, MN 55330
> Tel: 763-633-2500  Fax: 763-633-2550
> www.trackofthewolf.com
> [EMAIL PROTECTED]
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to