Hello Ewald,

lucene works purely alphabeticly, therefor, if you need to order on
numerical values, you can prepend the field with 0's.

So, for example, you would get 

0000000000002
0000000000100

Then, alphabetical ordering will go correct. The same holds for range
queries. 

Regards Ard

> 
> Hello,
> 
> I have a problem with sorting a DASL query on an metadata 
> field that I obtained by an extractor. The intention is that 
> the extractor calculates a numeric value, and then the 
> d:orderby should order on that value.
> However, I end up with a alphabetic ordering instead of a 
> numeric one (with ascending, I get 100 before 2). What do I 
> need to do to use a numeric sorting (to evaluate the values 
> as numbers?)
> 
> The relevant code in my extractor looks like:
> 
> <instruction property="courseDuration"
> namespace="http://hippo.nl/cms/1.0";
> xpath="/document/content/data/opleiding.duur*365"/>
> 
> And in my DASL Query:
> 
> <d:orderby>
>   <d:order>
>     <d:prop>
>       <h:courseDuration/>
>     </d:prop>      
>     <d:ascending/>
>   </d:order>
> </d:orderby>
> 
> Thanks for your help,
> 
> Ewald
> 
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
> 
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Reply via email to