Hi James, Have a look in Bugzilla at issue #34563. I contributed some code last night that may be helpful to you. Have a look at the patchTestSort.txt, which is a diff of my changes to test the classes I created. This may help you understand how to use the classes, but I assume based upon the value you are storing in the index you may only need the LongSortComparator.java which I attached to that Bugzilla issue.
Regards, Rus On 4/22/05, James <[EMAIL PROTECTED]> wrote: > > Hi Erik, > > Thanks for the reply. All dateTime fields are zero-padded and the > same length, and each indexed document has a valid dateTime value. > > Regarding the sort type, INT generates a ParseException, I assume > because the string has too many digits to fit in an int. I looked > for a LONG type but couldn't find one. So string was the next logical > choice. > > Regards, > James > > --- Erik Hatcher <[EMAIL PROTECTED]> wrote: > > > > On Apr 21, 2005, at 5:22 PM, James Levine wrote: > > > > > I have an index of around 3 million records, and typical queries > > > can result in result sets of between 1 and 400,000 results. > > > > > > We have indexed "dateTime" fields in the form 20050415142, that is, to > > > 10-minute precision. > > > > > > When I try to sort queries I get something back that is roughly sorted > > > on index, but not quite. Stuff is out of order just a bit. The > > > size of the result set does not seem to be related occurance of > > > this problem. > > > > > > We've tried lucene 1.4-final and1.4.3. > > > > > > my code looks like this > > > > > > s = new Sort( new SortField[] { new SortField( "dateTime", > > > SortField.STRING, > > > true ), SortField.FIELD_SCORE } ); > > > > > > ... > > > > > > hits = searcher.search( qry, s ); > > > > > > > > > Any help is appreciated, I'm so far baffled by this problem. > > > > I don't have a solution, but rather some questions to check.... are all > > dateTime's the same width, zero padded on the right? Does every > > document have a dateTime field? > > > > I recommend you sort with type INT instead of STRING if it fits, or > > maybe LONG. STRING will use the most resources for sorting. > > > > Erik > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]