Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Sorting Problem at Search Result

Quote Reply
Sorting Problem at Search Result
I have some database and want to
sorting the Search Result at "Title" filed,

For Excample, My Title have below :
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH

when my search the keyword "ABCD",
the result is :

ABCDEFG
ABC
ABCDEFGH
ABCDE
ABCD
ABCDEF
-----------------
i need the search result is follow a-z
at my "title" field , for example:-

ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH
--------------

Do u have any idea, Thanks.
Quote Reply
Re: Sorting Problem at Search Result In reply to
If you are using the search.cgi routines, it is probably because search returns the links in "score" order only.

You'd need to bypass that and do a direct select on the database:

Select * from table where title like 'ABCD%' order by title

Quote Reply
Re: Sorting Problem at Search Result In reply to
---------------------
Select * from table where title like 'ABCD%' order by title
---------------------
Hi Pugdog,
I don't understand above answer ?

"Select * from table where title like 'ABCD%' order by title"

Select from where? what file? or ??

Thanks.
Quote Reply
Re: Sorting Problem at Search Result In reply to
What I was saying is you'd probably have to rewrite the routines that find the links.

search.cgi uses the search.pm and DBSQL.pm modules to do the work. When Alex added the "score" feature, he made some changes to the logic that forced all the searches to be sorted in 'score' order.

The only way to bypass that is to do your own "select"

Now, if you are not worried about score order, and score, and just want to find all the items that match a given search, you can create your own "select" statement in SQL, that will take the 'query' and insert it into a pre-made SELECT statement that orders by whatever field you pass or hard code.

It would mean re-writing search.cgi or creating a new search_date.cgi that just returned matching links in date-order.

I haven't dug into this to see if it can be fixed, I've been waiting for the next release... since as I've said -- "time" is my most valuable commodity, and I hate re-inventing the wheel. If Alex is working on it, I'll work on something else Smile

A next release or update should be forthcoming soon. A lot has been going on, and he may have something 'really big' planned that's delaying it.


Quote Reply
Re: Sorting Problem at Search Result In reply to
 
Quote:
A next release or update should be forthcoming soon. A lot has been going on, and he may have something 'really big' planned that's delaying it.
I picture Alex behind the computer with either a big grin on his face or cringing... Smile These tantalizing tidbits could add up to a lot of pressure!

Dan
Quote Reply
Re: Sorting Problem at Search Result In reply to
I don't think I'm pressuring him, or giving away any great secrets. I'm just as anxious as anyone else to get them. Smile