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

'newupdate' links showing up last

Quote Reply
'newupdate' links showing up last
My 'newupdate' links in the category sections seem to be showing up at the very end of the search results versus at the beginning/top of the link search results (www.ohiobiz.com). What change in the code do I need to make in order to have them appear at the beginning?

Thanks.


Mark G.

Quote Reply
Re: 'newupdate' links showing up last In reply to
I should mention that this only seems to happen in the "search this category only" mode NOT the general category search - that seems to work properly.

Mark G.

Quote Reply
Re: 'newupdate' links showing up last In reply to
I tried it, and it does it in the general search mode too! Have a look in Links.pm at:

# The default sort orders for links.
$LINKS{build_sort_order_search} = what have you got here?


All the best
Shaun

Quote Reply
Re: 'newupdate' links showing up last In reply to
What is there is:

$LINKS{build_sort_order_category} = "Priority DESC,isNew,Title";
$LINKS{build_sort_order_new} = "Priority DESC,Title,Add_Date";
$LINKS{build_sort_order_cool} = "Priority DESC,Title";
$LINKS{build_sort_order_search} = "isNew,Title,isPopular";


Thanks.

Mark G.

Quote Reply
Re: 'newupdate' links showing up last In reply to
The sort order codes (DESC) needs to go at the end of field listing. Unfortunately, you cannot sort DESC and ASC across multiple fields.

Regards,

Eliot Lee
Quote Reply
Re: 'newupdate' links showing up last In reply to
You might want to add DESC after isNew and see if that makes a difference.

One "gotcha" is that isNew is an ENUM field, and if Yes is defined before No, then Yes will be "0" and No will be "1". This is backwards from what you might expect, but it's the array (field, set, whatever) position that determines ENUM sort order, not the actual value.

Sorting is a tricky thing, since if you try to sort on multiple fields, you have to look at how those fields interact. The first sort key will be how they are sorted first, the second key will determine how, giving the results of the first key-sort, can the results be sorted further, and the third, even further.

So, if you pick "Priority, isNew" as the criteria, then (assuming things work as expected, rather than how they do) Links will be sorted first in priority order, ascending, then within each of those priorities, the links will be sorted by isNew ascending.

If your lowest priority links have "new" links in them, they will appear at the END of the listing. First sort is by priority, _THEN_ by new.

To get new links at the top, you want to make sure that "priority" doesn't override "isNew".

So, sort by isNew, Priority DESC

This will put all "new" links (if Yes was defined before No) at the top of the list, and sort those by Priority, with the highest priority at the top. It will then take all the non-new links, and sort those, putting the highest priority on the top.

Make sense??

If you want to then sort by Alpha, you can add "Title" to the sort list, and then within each "priority" group you'd have links sorted alphabetically.

If you reversed it, isNew, Name, Priority ... what will happen?

Your new links will be at the top arranged in alphabetical order, if two links have the same title, the one with higher priority will be listed first.

The rest of the links will effectively be sorted by Name, since the "Name" field is pretty unique, it effectively overrides any effect "Priority" would have on the results, unless two links had the same title, in which case Priority would make a difference.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ