Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 24239 invoked from network); 30 Jul 2006 01:22:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Jul 2006 01:22:13 -0000 Received: (qmail 96120 invoked by uid 500); 30 Jul 2006 01:22:07 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 96089 invoked by uid 500); 30 Jul 2006 01:22:07 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 96078 invoked by uid 99); 30 Jul 2006 01:22:07 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jul 2006 18:22:07 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [169.229.70.167] (HELO rescomp.berkeley.edu) (169.229.70.167) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jul 2006 18:22:06 -0700 Received: by rescomp.berkeley.edu (Postfix, from userid 1007) id 3A9D55B774; Sat, 29 Jul 2006 18:21:44 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by rescomp.berkeley.edu (Postfix) with ESMTP id 34B917F403 for ; Sat, 29 Jul 2006 18:21:44 -0700 (PDT) Date: Sat, 29 Jul 2006 18:21:44 -0700 (PDT) From: Chris Hostetter To: java-user@lucene.apache.org Subject: Re: Sorting In-Reply-To: <5558212.post@talk.nabble.com> Message-ID: References: <5552408.post@talk.nabble.com> <200607291239.32695.mail@jasoncalabrese.com> <1154205724.4881.265.camel@localhost> <5558212.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N : thanks a lot for you helpfull answers :-)) I think I will try i like karl : suggest, cause i have to update the index every day :-)) All of the suggestions so far assume that you have some way of mapping each document to a number that indicates it's relative position in the total space of ordered documents -- which means that if you are updating the index on a daily basis, you are going to need some serious juggling to make sure that when a new document comes along, you figure out the "right" integer to put it into the correct order -- not to mention you have no solution for the day when you discover that "banana" is in your index with a sort value of 12345 and "bandana" is in your index with sort value 12346 -- and now you want to add "banco" and you don't have any room for it. A bigger problem is the fact that sorting by an int field takes just as much time as sorting by a String field -- because Lucene's sorting code is already doing the String->int mapping for you and putting it into a FieldCache. The only real difference between sorting on an int field and a String field is how much RAM that FieldCache uses (typically more for Strings) (NOTE: there are some caveats to this when dealing with MultiSearcher, but you didn't mention using a MultiSearcher, so i'm glossing over that) What *does* take more time when dealing with String fields is building the FieldCache (because sorting a bunch of strings tends to take longer then sorting a bunch of ints) ... but this Cache will only be built up the first time you sort on that field for a given IndexReader/IndexSearcher ... as long as you keep reusing the same IndexSearcher, things should be "fast". Without confirmation to the contrary, i'm guessing you aren't reusing the same IndexSearcher, and that's why it seems like sorting on Strings is slow. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org