Hi Yury,

You should separate the parts of the version string using #explode (from
the ParserFunctions extension), and then store the second half with a
property of type Number. If the version number can be 2.1 and the like,
then you can do something like turn the version number into parts "A" and
"B", and then set the property to a value like A * 100 + B, using #expr.

-Yaron

On Mon, Feb 18, 2013 at 12:06 PM, Yury Katkov <katkov.ju...@gmail.com>wrote:

> Hi Jeroen!
> My answers are inline
> On Mon, Feb 18, 2013 at 8:47 PM, Jeroen De Dauw <jeroended...@gmail.com>
> wrote:
> > Hey,
> >
> > What sort are you talking about exactly? The one done by ask or sort
> done by
> > some specific result format?
> >
> > The former is done using the sortkey of the DataItems in the db query. If
> > you have a property of type string, and thus have StringDataItem objects,
> > then the sortkey will just be the string, and your db will sort how it
> > thinks it should sort strings. If your property is of type number, then
> it
> > should be treated as a number by the db, so you ought to get the second
> list
> > you provided in that case.
> >
> > What are you dealing with exactly? If they are numbers, just make sure
> the
> > prop type is correct. If you have version numbers, such as 1.8.0.2,
> It's more like version numbers: of course technically those are
> strings and not numbers. But if they are sorted alphabetically the
> result is like in my first e-mail. I'm trying now to create my
> DataItem and override getSortKey() function.
>  then I'm
> > not sure how you'd go about having this sorted correctly by the db
> engine,
> > as you'd need the StringDataItem to somehow provided a sensible sortkey
> for
> > your version nr, which clearly it can't, since it does not (and should
> not)
> > know about version numbers.
> well somebody should know about them, or should be able to learn from
> me about them :) In fact we have a_lot of such quasi-numbers that are
> sorted incorrectly because they are represented as strings, like
> those:
>
> 1) 1.1.9<1.9.8<1.12.3 - those are not integers or floats and have to
> be parsed and
> then sorted
> 2) "Version 1 beta" < "Version 1 pre-release" < "Version 1" - here the
> sorting should consider the special words like "beta" and
> "pre-release"
> 3) "Hoary Hedgehog" < "Breezy Badger" < "Lucid Lynx" < "Oneiric Ocelot" <
> "Precise Pangolin" < "Quantal Quetzal" - here the sorting have to be
> set manually in the code
>
>
> >
> > Cheers
> >
> > --
> > Jeroen De Dauw
> > http://www.bn2vs.com
> > Don't panic. Don't be evil.
> > --
>
>
> ------------------------------------------------------------------------------
> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
> is your hub for all things parallel software development, from weekly
> thought
> leadership blogs to news, videos, case studies, tutorials, tech docs,
> whitepapers, evaluation guides, and opinion stories. Check out the most
> recent posts - join the conversation now.
> http://goparallel.sourceforge.net/
> _______________________________________________
> Semediawiki-devel mailing list
> Semediawiki-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>



-- 
WikiWorks · MediaWiki Consulting · http://wikiworks.com
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to