[drupal-devel] [bug] New pager code broken taxonomy pagers

Steven drupal-devel at drupal.org
Fri May 27 13:19:21 UTC 2005

Issue status update for http://drupal.org/node/23687

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Morbus Iff
 Reported by:  Morbus Iff
 Updated by:   Steven
 Status:       patch

Maybe it's crazy, but it has a single, pagable query and an unambigous
sorting both ways. It works well for what it needs to do.

In fact, the only problem is the assignment of numbers because we
cannot do a "natural order" sort in SQL. Right now it uses a rather
inefficient coding that scales O(n) with size and adds another digit
every 10 values.

This prompted me to experiment with better codings. First I generalized
the current scheme a bit, then tweaked it to get near O(log n) scaling
and on average only 20-30% more digits than an equivalent decimal
notation, while still retaining the string sorting property. Quite fun

I don't see the problem with the approach though... all it does is
store a compact ordering key per row. Compare this to the convoluted
tree logic in taxonomy_get_tree() and I know which one I prefer.

Of course, I'm not at all sure if the comment.module approach can be
implemented here, but I can't believe you'd do something like this
after talking about mega-taxonomies for so long. Loading in 8000 tags
just to show 50 is nowhere near optimal.


Previous comments:

May 26, 2005 - 21:44 : Morbus Iff

I've not yet looked into it, but I doubt I'll be able to fix it (the
original taxonomy/term pager code was a hack that moshe taught me
about). In a nutshell, though, the recent pager cleanup in head has
broken the term pagers for vocabularies.


May 26, 2005 - 22:21 : Morbus Iff

Attachment: http://drupal.org/files/issues/_p_23687_taxopager.patch (1.88 KB)

Patch attached.


May 27, 2005 - 09:05 : Steven

Why can't this code use pager_query() and query the database directly?
If free tagging vocabularies can get so big, it seems a very
inefficient thing to fetch the entire list.


May 27, 2005 - 09:05 : Steven

Note: if you need to fetch a list of tags ordered by hierarchy in one
query, you should look at how comment.module does it.


May 27, 2005 - 13:17 : Morbus Iff

Which part of comment.module? I hope you don't think the crazy "thread
1.1.2/, 1.2" stuff is /better/.

More information about the drupal-devel mailing list