sort-bookmarks icon indicating copy to clipboard operation
sort-bookmarks copied to clipboard

Not sorting correctly

Open Gitoffthelawn opened this issue 5 years ago • 6 comments

When sorting by URL, bookmarks are not being sorted correctly.

Also, is it ignoring the portion of the URL that consists of parameters (everything after a question mark), or is it using that data too?

Gitoffthelawn avatar Apr 20 '20 00:04 Gitoffthelawn

After performing more testing, it's not just URL sorting that has an issue. It's all sorting.

I think it may be limited to folders with a large number of bookmarks. I tested it on one of my "need to sort" bookmark folders, which unfortunately, currently has 1919 bookmarks. We'll need a few more worldwide shutdowns until I get through that tedious project.

What happens is that, after sorting, there are multiple sections of properly sorted bookmarks within a folder. The result takes on this form:

A
B
C
A
B
C

BTW, Firefox has native alphabetic bookmark sorting included, and it's very fast. Can you access it via an API? If so, does it have any parameters to specify other sort-by fields?

Gitoffthelawn avatar Apr 20 '20 03:04 Gitoffthelawn

Do you have separators between the sorted sections?

heftig avatar Apr 20 '20 06:04 heftig

No separators.

The results make me think that there may be a recursive process that is iterating one too few times.

Gitoffthelawn avatar Apr 20 '20 07:04 Gitoffthelawn

Not quite; the code assumes that gaps in the indices of items mean separators are present. This was the case in Firefox before version 57, when separators became explicit items. So every continuous run of indices is sorted separately. Are there other special items between the sorted sections that don't show up in the API? The sort can't produce predictable results when we don't see all items.

heftig avatar Apr 20 '20 08:04 heftig

What type of other special items? There are no items visible within Firefox between the sections.

Gitoffthelawn avatar Apr 20 '20 08:04 Gitoffthelawn

I don't know if it's relevant, but the first character of the bookmark title of the last item in the first section is a single quote. That title contains a total of 4 single quotes, and a comma after the quotes. This is the title:

'Clean Home' With 'Private Bathroom' on Airbnb Just a Roadside Shipping Container, Guest Says - Gizmodo

I can't imagine it's relevant, but the URL is:

https://gizmodo.com/clean-home-with-private-bathroom-on-airbnb-just-a-roads-1834721410

The first item in the next group has nothing special about it at all. It consists of "https://" followed by just uppercase/lowercase letters and dashes. It's title is just letters and a dash.

Gitoffthelawn avatar Apr 20 '20 08:04 Gitoffthelawn