Item9364: MT claimed on irc that trunk doesn't sort numbers like 1.0.9

pencil
Priority: Normal
Current State: Closed
Released In: 1.0.10, 1.1.0
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: SvenDowideit
Waiting For:
Last Change By: KennethLavrsen
MTempest 1.0.x's Foswiki::Search::_sortTopics uses a _compare function that is "number-aware". However, trunk's Foswiki::Search::InfoCache::sortTopics uses cmp. It looks to me like 1.0.9 is more "functional" than trunk!

see http://irclogs.foswiki.org/bin/irclogger_log/foswiki?date=2010-07-07,Wed&sel=445#l441

in an attempt to figure out if he's right, I started to write some tests...

(personally, when I look at the code in trunk, it has the same naf number awareness as 1.0)

-- SvenDowideit - 21 Jul 2010

this seems to have been spawned from
MartinKaufmann   Is there a possibility to sort the output of a SEARCH not alphabetically but numerically? 
I've got a SEARCH with order="formfield(DocumentID)" and the ID is a number. 
Now I get 1, 10, 11, 12, 2, 3, 4, ...

I hope Martin was using tmwiki - but its just as possible that he was being caught by a space in the field?

lets see if Michael has more than the unit tests i added show..

-- SvenDowideit - 21 Jul 2010

As I clarified later on in that IRC discussion, my IDs are not just numbers. They are of the form "ID 1-1-1". I'm using Foswiki 1.0.9 and the sort order I got originally was the following:

  • ID 1-1-1
  • ID 1-1-10
  • ID 1-1-11
  • ID 1-1-2
  • ...

I applied MichaelTempest's patch to get the order I wanted. I'm aware of course that this patch is a hack which only works for this one particular case.

I don't know anything about Michael's claim wrt _compare in trunk vs 1.0.9.

-- MartinKaufmann - 21 Jul 2010

I am sorry, Sven. I was wrong. And I'm delighted to be wrong smile

All I can plead is that you read what I wrote a second later: "Please tell me I'm missing something? And preferably also what I am missing? :)"

I see my mistake now - topic names are sorted with cmp but everything else uses the compare function which uses the same kind of logic as 1.0.9. I missed that the first time around.

So there isn't a number-sorting problem on trunk.

-- MichaelTempest - 24 Jul 2010

ah, darn smile

Martin, I see - that's what the pluggable sorting proposal was for huh - cool - I guess all we've gotten is more unit tests, so it was worth it big grin

I wanted to think about something related, so i'll leave it open for now

-- SvenDowideit - 24 Jul 2010

I am closing this.

If there is no bug to fix we close, and if "think about something related" is something that needs fixing then open a bug report for that. Otherwise the rest of us keep on opening these bug reports just to find there is nothing to be done

-- KennethLavrsen - 31 Jul 2010

 

ItemTemplate edit

Summary MT claimed on irc that trunk doesn't sort numbers like 1.0.9
ReportedBy SvenDowideit
Codebase trunk
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:bb1ea713b17e distro:a1ed02648d4e distro:f4f6dcf4c2dd distro:3f81b9074489
TargetRelease minor
ReleasedIn 1.0.10, 1.1.0
Topic revision: r12 - 31 Jul 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy