Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 92953 invoked from network); 15 Oct 2008 03:37:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Oct 2008 03:37:08 -0000 Received: (qmail 14528 invoked by uid 500); 15 Oct 2008 03:37:02 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 14500 invoked by uid 500); 15 Oct 2008 03:37:02 -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 14489 invoked by uid 99); 15 Oct 2008 03:37:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Oct 2008 20:37:02 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.69.42.181] (HELO radix.cryptio.net) (208.69.42.181) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Oct 2008 03:35:56 +0000 Received: by radix.cryptio.net (Postfix, from userid 1007) id 5F60371C47E; Tue, 14 Oct 2008 20:36:03 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by radix.cryptio.net (Postfix) with ESMTP id 5BF1C71C437 for ; Tue, 14 Oct 2008 20:36:03 -0700 (PDT) Date: Tue, 14 Oct 2008 20:36:03 -0700 (PDT) From: Chris Hostetter To: java-user@lucene.apache.org Subject: Re: Custom Sorting Based on Input Value In-Reply-To: <359a92830810140520p21d6d3cfj72b58ea9d45efd5d@mail.gmail.com> Message-ID: References: <19963673.post@talk.nabble.com> <359a92830810140520p21d6d3cfj72b58ea9d45efd5d@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org : 3> maybe you could provide a custom sorter by using : SortComparator, although you should look at the warnings : in the API. : : Now I'll wait for Hoss to say "Isn't that what XXX provides" ... I can't think of anything that would solve this problem direclty, mianly because i can't think of any practical use for a requirement like this, but one way it should be possible to solve this while avoiding the pitfalls people run into when subclassing SortComparator would be to avoid SortComparator (and it's use of FieldCache.DEFAULT.getCustom) and implement SortComparatorSource directly ... you don't need to *cache* a big array of true/false booleans for when the value does or doesnt' equal your magic input, can use FieldCache.DEFAULT.getInt or FieldCache.DEFAULT.getStrings, or whatever you need directly (just like a normal sort) but let the compare and sortValue short circut if the value isn't what it needs to be. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org