AnsweredAssumed Answered

Proper Sorting by Integer

Question asked by pcorliss on Feb 18, 2010
I'm trying to have a web script return lucene results for a specific form and sort by a custom type. However when I run the query it sorts the integer as if it were a string such that I get the following instead of a normal numerical sort. Is there anything I can do to prevent this? The number of items may grow such that doing a query that pulls in all the results for a specific content type and doing the sorting in something like freemarker would be prohibitive.

Apple - 1
Dole - 11
Banana - 2
Carrot - 3

var sort1 =
     column: "@wp:rank",
     ascending: true

var paging =
     maxItems: 10,
     skipCount: 0

var def =
     query: '@wca\\:parentformname\\:"sampleform"',
     store: "avm://samplestore",
     language: "lucene",
     sort: [sort1],
     page: paging

<property name="wp:rank">
   <index enabled="true">