Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 89554 invoked from network); 16 Jun 2004 12:20:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Jun 2004 12:20:34 -0000 Received: (qmail 95065 invoked by uid 500); 16 Jun 2004 12:20:27 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 95023 invoked by uid 500); 16 Jun 2004 12:20:27 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 94993 invoked by uid 99); 16 Jun 2004 12:20:26 -0000 Received: from [128.143.135.143] (HELO postfix.mail.ehatchersolutions.com) (128.143.135.143) by apache.org (qpsmtpd/0.27.1) with ESMTP; Wed, 16 Jun 2004 05:20:26 -0700 Received: from [127.0.0.1] (localhost [127.0.0.1]) by postfix.mail.ehatchersolutions.com (Postfix) with ESMTP id E665778CC77 for ; Wed, 16 Jun 2004 08:20:17 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <8594C057-BF8F-11D8-B5A8-000393A564E6@ehatchersolutions.com> Content-Transfer-Encoding: 7bit From: Erik Hatcher Subject: Re: RuntimeException: cannot determine sort type! Date: Wed, 16 Jun 2004 08:20:14 -0400 To: "Lucene Users List" X-Mailer: Apple Mail (2.613) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Jun 16, 2004, at 7:25 AM, iouli.golovatyi@group.novartis.com wrote: > > > Well, I just didn't want to overload people with too much code. There is an art to providing just enough detail :) > doc is created like this ("modified" get formated with SimpleDateFormat > tformat = new SimpleDateFormat ("yyyyMMddhhmmss") by cashToIndex metod, > where the IndexWriter created) : > > > doc.add(Field.Keyword("modified",DateField.timeToString(modified))); > This looks fine. > formated_query=query.toString(); > if (sort_byscore)hits = ms.search(query); > else hits = ms.search(query,new > Sort("modified",true)); > // here the "cannot determine.." exception generated!!! How about using: ms.search(query, new Sort(new SortField("modified", SortField.STRING, true))); Does that fix it? If "modified" is only there for sorting and not for querying, perhaps index it as a Integer.toString or Float.toString instead - this will give you better resource usage and performance most likely - and change the type to SortField.INT or SortField.FLOAT appropriately. The sorting infrastructure can detect a type, but it may have issues doing so if the strings look like a number in the first document but later appear like a String. DateField.timeToString makes them String, so forcing it to sort on String type should work. Erik --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org