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

Category order in Search Results

Quote Reply
Category order in Search Results
Hi,

The categories in my search results don't display in alphabetical order. Here's a cut-down example from a search for 'Book':

Travel and Tourism :Train Travel :Ticket and Booking Services
Business :Companies :Books
Shopping and Services :Books :Booksellers
Shopping and Services :Books
Reference :Booksellers

... I'd like them like this ...

Business :Companies :Books
Reference :Booksellers
Shopping and Services :Books
Shopping and Services :Books :Booksellers
Travel and Tourism :Train Travel :Ticket and Booking Services

Here's the sort order settings I currently have in links.pm:

# The default sort orders for links.
$LINKS{build_sort_order_category} = "isTop,isNew,Title";
$LINKS{build_sort_order_new} = "Add_Date,Title";
$LINKS{build_sort_order_cool} = "Title";
$LINKS{build_sort_order_search} = "isNew,isTop,Title";

I assume (maybe incorrectly) that $LINKS{build_sort_order_search} is for how the links will look 'under' each sorted category displayed, rather than for the entire search results?

Would I need to reference the category name somewhere in $LINKS{build_sort_order_search} ?

Any help appreciated :)

All the best
Shaun

Quote Reply
Re: Category order in Search Results In reply to
I never looked at it that detailed, but you might want to follow the path of the program, until you get to the SELECT statement for the sub categories.

Look at what it's doing in the sort. I believe it would be before the "build_category_linked" (or similar) call to return the linked category name.

All this is going to change in the next version, so use it as a learning example for perl <G>

With the new category logic, sorting/selecting will be different.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Category order in Search Results In reply to
Pugdog,

Thanks for the advice - I took a quick look in search.cgi and search.pm - and it appears that search.cgi uses the Category ID field when sorting the results and then parses the name using the sub 'get_category_name'. I haven't quite got the experience to change this and its not a critical change, so I'll wait to see what the next version brings as its all set to change anyway :)

All the best
Shaun



Quote Reply
Re: Category order in Search Results In reply to
you can sort through two databases...

actually.. you can sort through many databases..

example..

SELECT *.Links FROM Links, Category ORDER BY Name.Category ASC, Title.Links ASC

will get all the links in the database sorted by category name and then title..

Jerry Su