Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 90785 invoked from network); 28 Sep 2005 14:59:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Sep 2005 14:59:23 -0000 Received: (qmail 6644 invoked by uid 500); 28 Sep 2005 14:59:17 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 6624 invoked by uid 500); 28 Sep 2005 14:59:17 -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 6605 invoked by uid 99); 28 Sep 2005 14:59:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2005 07:59:17 -0700 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=FROM_ENDS_IN_NUMS,HTML_20_30,HTML_MESSAGE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of andyliu1227@gmail.com designates 66.249.82.192 as permitted sender) Received: from [66.249.82.192] (HELO xproxy.gmail.com) (66.249.82.192) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2005 07:59:23 -0700 Received: by xproxy.gmail.com with SMTP id h27so26636wxd for ; Wed, 28 Sep 2005 07:58:55 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=sIdg4nCDvJQsyAl4viATMjYhJiJihQPzfpu4Qk3TeLtumsmESKWv8PtVcKhY4aF1NAvbxfaz0YdHl81Tb/5k1F/SYKBrBke6vkxfwOIsSNXKPZwrfKr/NfSGc95AQxcvAKT753ZW4tQNyrNm6yw0pLRceBLrhh74INWFMU8+ccU= Received: by 10.70.24.4 with SMTP id 4mr1420010wxx; Wed, 28 Sep 2005 07:58:54 -0700 (PDT) Received: by 10.70.21.11 with HTTP; Wed, 28 Sep 2005 07:58:54 -0700 (PDT) Message-ID: <32dca9ed0509280758f0e6d10@mail.gmail.com> Date: Wed, 28 Sep 2005 10:58:54 -0400 From: Andy Liu Reply-To: Andy Liu To: java-user@lucene.apache.org Subject: Re: A very technical question. In-Reply-To: <433AA7AD.3070204@cs.put.poznan.pl> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4357_2119024.1127919534316" References: <433AA7AD.3070204@cs.put.poznan.pl> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_4357_2119024.1127919534316 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline While you're indexing, you can assign each doc with a field that refers to how long the document is. So, for example, you can add a field named "docLength" for each document, and assign it with discrete values such as "veryshort", "short", "medium", "long", "verylong", depending on how granular you need it. Then at query time you can specify the field and a given boost value, i.e. civil war docLength:verylong^5 docLength:long^3 Andy On 9/28/05, Dawid Weiss wrote: > > > Hi. > > I have a very technical question. I need to alter document score (or in > fact: document boosts) for an existing index, but for each query. In > other words, I'd like these to have pseudo-queries of the form: > > 1. civil war PREFER:shorter > 2. civil war PREFER:longer > > for these two queries, 1. would score shorter documents higher then > option 2, which would in turn score longer documents higher. Note that > these preferences can be expressed at query time, so static document > boosts are of little help. > > I'd appreciate if those familiar with the internals of Lucene gave me > brief instructions on how this could be achieved (my rough guess is that > I'll need to build my own Scorer... but how to access document length > and where to plug in that scorer... besides I'd rather hear it from > somebody with more expertise). > > Thanks, > D. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > -- Andy Liu andyliu1227@gmail.com (301) 873-8458 ------=_Part_4357_2119024.1127919534316--