Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 79120 invoked from network); 3 Jul 2006 21:26:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Jul 2006 21:26:45 -0000 Received: (qmail 48304 invoked by uid 500); 3 Jul 2006 21:26:41 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 47972 invoked by uid 500); 3 Jul 2006 21:26:39 -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 47954 invoked by uid 99); 3 Jul 2006 21:26:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jul 2006 14:26:39 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of monsurh@gmail.com designates 64.233.162.198 as permitted sender) Received: from [64.233.162.198] (HELO nz-out-0102.google.com) (64.233.162.198) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jul 2006 14:26:38 -0700 Received: by nz-out-0102.google.com with SMTP id o1so934086nzf for ; Mon, 03 Jul 2006 14:26:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=d+2wH8V66BebEHcbzu/pD9IpjAaVsYn6fFnuUvb6OCg4sbHVOt/h7v1OpKRNmTv5HWcneAvWh9lfhdMhtrnzDmDdSkAeZ+o3k0LxwIdUHvi8oqtV+d0K2R+qYzPfBTFYS7KE0ZdgRVmWo1NEMhK/God3RRG2/9yXbFnvnMt1DLA= Received: by 10.36.134.3 with SMTP id h3mr2540080nzd; Mon, 03 Jul 2006 14:26:17 -0700 (PDT) Received: by 10.36.5.16 with HTTP; Mon, 3 Jul 2006 14:26:17 -0700 (PDT) Message-ID: Date: Mon, 3 Jul 2006 17:26:17 -0400 From: "Monsur Hossain" To: java-user@lucene.apache.org Subject: Re: Sorting & SQL-Database In-Reply-To: <200607010110.50154.dominik@dbruhn.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200607010110.50154.dominik@dbruhn.de> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On 6/30/06, Dominik Bruhn wrote: > SELECT id,addfield FROM table WHERE id IN ([LUCENERESULT]); > > Where LUCENERESULT is like 2,3,19,3,5. > > This works fine but got one problem: The Search-Result of Lucene is order by > relevance and so the id-list is also sorted by relevance. But the result of > the SQL-Query is sorted by the id which destroys the relevance-sorting. > > Does anybody know a work-arround? We have the same issue and solve this through code. As you're generating the list of IDs for the SQL query, also generate a hash that maps the ID to its position. When reading back the data from the database, read the position hash, and insert the item into the appropriate position in an array. Yeah, you're doing the sorting yourself, but in our case, we're only returning 10 items per page, so its not a huge performance hit. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org