Gossamer Forum
Home : Products : Gossamer Links : Discussions :

search results sort order

Quote Reply
search results sort order
Hi Alex, everyone,

I posted about this issue a few days ago but, i've done a little more digging and am wondering if the following might be able to shed any light on the problems that we've been having.

Here's my original post:

--

I'm having some problems getting the priority links modification (as seen in the modification forum of the Links Resources bit on this site which can be found at http://run-down.com/mods/links_sql_priority.php) to work with Links SQL 2.1

I had it working like a dream with Links SQL 2.05 but, since upgrading to the newer version if I set the build_sort_order_search variable under setup/search options to Is_premium as the field to sort against, it isn't playing ball. I have that column in the Links_Links table set up exactly as stipulated in the mod. (where the column is called Priority)

The strange thing is that I have set the variable build_sort_order_category to build using the same field and that seems to work absolutely fine..

I've tried reindexing the database, repairing the search etc. and none of that seems to help at all

Hope someone has an idea of what has changed in Links SQL 2.1 to cause this mod to stop working.

--

For a test we have selected a search based on the word "Royal" as we know that there are several links containing the word "royal" and 1 of them is a premium link. We have tried running the SQL command: select * from Links_Links where title like '%royal%' order by Is_premium DESC limit 5; which returns the values in the correct order. However, when using the Links search facility (with 'royal' as the search term) the premium link is at the bottom of the list instead of at the top (we use Is_premium to determine whether the link appears in the top part of the returned link list. If a link is a premium link the value is 1, 0 otherwise). The SQL command: select * from Links_Links where title like '%royal%' limit 3; returns the links in the same order as
they appear on the web page when using the search utility. We know that DBI is being used and we suspect that it may be to do with the way the results of the select statement are retrieved from the hash (since the 'order' is
incorrect). The Is_premium flag method worked fine under 2.05.

Hope somebody might be able to shed some light on the problem! Smile

Cheers,

Hannah
Quote Reply
Re: [hannahmackenzie] search results sort order In reply to
Hi,

Try changing the sort order in Setup->Search Options to 'Is_Premium DESC' instead of just Is_Premium.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] search results sort order In reply to
Hi Alex,

We've tried that already - and we've even tried Is_Premium ASC just to see what that does - all to no avail. Crazy

Any other ideas?

Thanks,

Hannah
Quote Reply
Re: [Alex] search results sort order In reply to
I am having a similar problem with the sorting. I created a new column called "Root_Rating" with a default value of 0. I then updated two URLs (both "http://www.3com.com/") and gave them a "Root_Rating" value of 10. I then changed my build_sort_order_search setting to "Root_Rating DESC". However, I STILL don't get those URLs listed first when I do a search for the word "3Com".

Sean
Quote Reply
Re: [hannahmackenzie] search results sort order In reply to
By default it seems to sort ascending. It's only when you add "ASC" or "DESC" to the setting that it doesn't work at all.

Sean
Quote Reply
Re: [Alex] search results sort order In reply to
Alex,

Has the syntax (using ASC and DESC) changed for this in the new version?

Sean
Quote Reply
Re: [SeanP] search results sort order In reply to
Just out of curiousity, when you changed the sort order, did you set the whole field to just

field_name DESC

or are you trying to sort on several parameters?

Are your fields all weighted? Did you re-index?


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] search results sort order In reply to
I created a column called Root_Priority, and gave the url www.3com.com a value of 1 (all others have 0). I then I added:

Root_Priority DESC

to the sort order. I then did a search for the word 3com, and the URL www.3com.com ended up fourth or fifth in the results. Am I missing something, or wouldn't that logically put www.3com.com first because it is set to 1 and all others are set to 0?

When I take "DESC" off, it sorts the results ascending, and www.3com.com ending up last in the results. It's like it doesn't work at all when I add "ASC" or "DESC" to the setting.

Sean

In Reply To:
Just out of curiousity, when you changed the sort order, did you set the whole field to just

field_name DESC

or are you trying to sort on several parameters?

Are your fields all weighted? Did you re-index?

Last edited by:

SeanP: Feb 27, 2002, 7:35 PM
Quote Reply
Re: [Alex] search results sort order In reply to
Alex,
Does adding ASC or DESC to this not work anymore in 2.1.0???

Sean
Quote Reply
Re: [SeanP] search results sort order In reply to
I am also interested in this ...

Alex?
Quote Reply
Re: [Payooo] search results sort order In reply to
Hi-

I also have this same problem with the sorting of the search results after upgrading to 2.1.0 Unimpressed. I wonder if anyone has found an answer yet?

-FrankM
Quote Reply
Re: [FrankM] search results sort order In reply to
Right guys - have a possible solution for you.
Create a new column called "Priority" and set it as a CHAR column with a maximum size of 1. This column can be one of 2 values - A or B. A for premium listings and B for standard listings. Set a few of your listings up as premium ones so that you can do a successful test or two.

Then set the build_sort_order_search variable to sort by this column. I haven't added a DESC or an ASC indicator as it seems to work without. And with any luck your listings designated as A listings should appear first and your other listings afterwards as the column is sorted alphabetically.

This mod also works for the build sort order variable found under the build setup menu. There I have it set to sort by Priority and then the "Title" column so that the remaining links sort alphabetically.

Hope that sorts out the problem - it seems to have done the trick for us. No idea why the numeric version of this mod won't work anymore: as I said in my first posting if you run it against the db in pure SQL it works fine.

Hannah
Quote Reply
Re: [hannahmackenzie] search results sort order In reply to
If I do what you have said, and give one link the value of "A", it displays that link first on EVERY page, not just the first page. I set the link http://www.microsoft.com to "A" and did a search for "microsoft". I got that link first and thought it was working properly, but when I go to the next page, and the next, I realized it is showing up on EVERY page. Isn't it supposed to sort the entire results with that link displayed first and only once?
Quote Reply
Re: [hannahmackenzie] search results sort order In reply to
Hi,

This is a bug, the fix can be found:

http://www.gossamer-threads.com/...orum.cgi?post=185049

Sorry about the headache.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] search results sort order In reply to
Weh hey!

Thanks Alex.

Cheers,

Hannah
Quote Reply
Re: [Alex] search results sort order In reply to
Thanks Alex! Looks like you hit two birds with one stone! Laugh Thanks again...

Sean