Bitcoin Forum

Other => Archival => Topic started by: Symmetrick on July 30, 2021, 11:40:09 AM



Title:
Post by: Symmetrick on July 30, 2021, 11:40:09 AM


Title: Re: Strange Work of Sorting Topics
Post by: PrimeNumber7 on July 30, 2021, 12:17:28 PM
I am not 100% certain, but I suspect this has to do with how the database is queried when sorting. When you visit a page, the database query limits 20 results and when you are visiting a page other than the first one, an offset is used. I believe a likely solution would be to always have a sort by topic ID to be used after all other sort criteria is applied.


Title: Re: Strange Work of Sorting Topics
Post by: Rizzrack on July 30, 2021, 12:28:46 PM
Not sure what the problem is because the sorting by "Replies" works for me, without some duplicates here and there.
If I sort by Replies I get the first 31 pages with 0 replies and then 1 reply starts from page 32
https://i.imgur.com/HPwKo7U.png

And also the sort by "Started by" works as advertised. It orders by OP. It is true that the multiple threads opened by the same user are not sorted, but it is to be expected because there is no other keyword except ";sort=replies".


Title: Re: Strange Work of Sorting Topics
Post by: Maxine4466 on August 01, 2021, 02:25:56 PM
I often look for new projects in the ANN section (although there are few good projects now), the order of ANN's posts is different from other sections. There is a special mechanism called bump. I guess the strange order mentioned by OP in the topic may have something to do with this
In addition, posts are usually sorted in chronological order. I hope to find new projects with potential, not the more well-known projects that have been released before (because their profits are not as high as new projects)


Title: Re: Strange Work of Sorting Topics
Post by: examplens on August 01, 2021, 06:34:06 PM
As I know, this is about the power of the bump. a system introduced to reduce spam by Newly created accounts to create fake discussion and useless spam. Threads, where better ranked activity + earned merit members write, will always be ahead of threads with a bunch of spam posts from newbies.
Here is probably most of the answers Bumping changes on some boards (https://bitcointalk.org/index.php?topic=5183553.0)


Title: Re: Strange Work of Sorting Topics
Post by: PrimeNumber7 on August 01, 2021, 08:26:32 PM
As I know, this is about the power of the bump. a system introduced to reduce spam by Newly created accounts to create fake discussion and useless spam. Threads, where better ranked activity + earned merit members write, will always be ahead of threads with a bunch of spam posts from newbies.
Here is probably most of the answers Bumping changes on some boards (https://bitcointalk.org/index.php?topic=5183553.0)

The bumping changes should only affect the order of threads when default sorting is used. The OP is referring to threads sorted via custom criteria.


Title: Re: Strange Work of Sorting Topics
Post by: suchmoon on August 01, 2021, 09:31:38 PM
Even if you select sorting and press F5, the location of the topics will always change. This is not sorting, this is pure randomness.

It's not really random, it's probably whatever the database (MySQL?) does when you don't specify a sort order. I'm guessing that when you sort by a column, it generates a SQL query that has only that column in the "order by" clause and no fallback sort that would be used in case there are multiple records with the same column value (e.g. multiple threads with 0 replies).

Something like this:

Code:
select thread_id, thread_title, ...
from threads
order by replies

Technically not exactly a bug as it's doing what you want it to do (since you're asking it to sort by replies), but surely inconvenient (since you can't specify additional sort order even if you wanted). A workaround in the code should be simple, just add e.g. thread id as the last part of the "order by", so that the resulting order is always defined the same way.

Like this:

Code:
select thread_id, thread_title, ...
from threads
order by replies, thread_id


Not sure what the problem is because the sorting by "Replies" works for me, without some duplicates here and there.
If I sort by Replies I get the first 31 pages with 0 replies and then 1 reply starts from page 32
https://i.imgur.com/HPwKo7U.png

And also the sort by "Started by" works as advertised. It orders by OP. It is true that the multiple threads opened by the same user are not sorted, but it is to be expected because there is no other keyword except ";sort=replies".

I couldn't reproduce the issue with replies, but it did happen with "started by" - the ETC pool thread id 1651959 appeared on page 6 and page 7, then after a few refreshes disappeared from both, then appeared only on page 6, etc (pun not intended).


Title: Re: Strange Work of Sorting Topics
Post by: Stalker22 on August 01, 2021, 09:43:22 PM
Not sure what the problem is because the sorting by "Replies" works for me, without some duplicates here and there.
If I sort by Replies I get the first 31 pages with 0 replies and then 1 reply starts from page 32

From this, the randomness within these 32 pages with 0 answers will not go anywhere. If I want to view all these 32 pages, then I will see the arrangement of the topics at random and throughout these 32 pages the topics will be repeated many times.

Interesting. I had never noticed that bug before.
As suchmoon suggested, it is possible that the system does not have a defined fallback sorting criterion. Typically a topic ID should be used since it is unique for every topic.


Title: Re: Strange Work of Sorting Topics
Post by: Rizzrack on August 01, 2021, 09:46:15 PM
I couldn't reproduce the issue with replies, but it did happen with "started by" - the ETC pool thread id 1651959 appeared on page 6 and page 7, then after a few refreshes disappeared from both, then appeared only on page 6, etc (pun not intended).

Might not be duplicates... unless you see them on the same page.
I just assume the order is mixed when you change the page.

Let's assume your posts are from the middle on page 10 to end of page 15. Those threads might get shuffled while changing pages and some threads can be seen again on some other pages. Not certain but seems likely that this is the "bug" here.


Title: Re: Strange Work of Sorting Topics
Post by: suchmoon on August 01, 2021, 10:28:56 PM
Might not be duplicates... unless you see them on the same page.
I just assume the order is mixed when you change the page.

Let's assume your posts are from the middle on page 10 to end of page 15. Those threads might get shuffled while changing pages and some threads can be seen again on some other pages. Not certain but seems likely that this is the "bug" here.

Yes, that's what it looks like and I think the biggest issue here is that you can't work around it from the user interface. For example if you could specify multiple "sort" columns in the URL, like ';sort=replies,first_post', that would be a clunky but possible workaround. But I don't think you can do that, at least none of the "hacks" I tried seem to be working and SMF source code seems to imply that only the following options are allowed:

Code:
	// Default sort methods.
$sort_methods = array(
'subject' => 'mf.subject',
'starter' => 'IFNULL(memf.realName, mf.posterName)',
'last_poster' => 'IFNULL(meml.realName, ml.posterName)',
'replies' => 't.numReplies',
'views' => 't.numViews',
'first_post' => 't.ID_TOPIC',
'last_post' => 't.ID_LAST_MSG'
);



Title: Re: Strange Work of Sorting Topics
Post by: Rizzrack on August 01, 2021, 10:56:12 PM
Yes, that's what it looks like and I think the biggest issue here is that you can't work around it from the user interface. For example if you could specify multiple "sort" columns in the URL, like ';sort=replies,first_post', that would be a clunky but possible workaround. But I don't think you can do that, at least none of the "hacks" I tried seem to be working

Not sure cos on mobile but ;sort=starter;desc seems to do the trick ...


Title: Re: Strange Work of Sorting Topics
Post by: suchmoon on August 01, 2021, 11:01:57 PM
Not sure cos on mobile but ;sort=starter;desc seems to do the trick ...

That just makes it sort descending. The issue is still happening.


Title: Re: Strange Work of Sorting Topics
Post by: PrimeNumber7 on August 01, 2021, 11:45:48 PM
I am not 100% certain, but I suspect this has to do with how the database is queried when sorting. When you visit a page, the database query limits 20 results and when you are visiting a page other than the first one, an offset is used. I believe a likely solution would be to always have a sort by topic ID to be used after all other sort criteria is applied.
Technically not exactly a bug as it's doing what you want it to do (since you're asking it to sort by replies), but surely inconvenient (since you can't specify additional sort order even if you wanted). A workaround in the code should be simple, just add e.g. thread id as the last part of the "order by", so that the resulting order is always defined the same way.
Hmmm, Plagiarism?  :D  8)  ::) 🤔👩‍💻


Title: Re: Strange Work of Sorting Topics
Post by: Pmalek on August 02, 2021, 04:40:21 PM
I thought it might be something browser-specific, but the same thing happens on all the browsers I tried (Chrome, Firefox, Edge). I only tried the 'sorting threads by replies' thingy and those two topics from fabioganga really do appear on both page 1 and 4 across all browsers. This is something that is best directed to theymos. He surely knows the ins and outs of this forum better than anyone else.