Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 63516 invoked from network); 4 Oct 2006 14:22:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Oct 2006 14:22:56 -0000 Received: (qmail 40968 invoked by uid 500); 4 Oct 2006 14:22:43 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 40826 invoked by uid 500); 4 Oct 2006 14:22:43 -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 40700 invoked by uid 99); 4 Oct 2006 14:22:42 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Oct 2006 07:22:42 -0700 Authentication-Results: idunn.apache.osuosl.org header.from=khoon.ee.gan@gmail.com; domainkeys=good X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 Received: from [64.233.182.188] ([64.233.182.188:39527] helo=nf-out-0910.google.com) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 1C/96-00170-583C3254 for ; Wed, 04 Oct 2006 07:22:24 -0700 Received: by nf-out-0910.google.com with SMTP id c2so60015nfe for ; Wed, 04 Oct 2006 07:20:54 -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:references; b=tdSJmc9uBC3gTxb9P3diKwKEwGJo2ZhOck3KJiqepRbhdIVl1VyOLRu6H8YNaNeXbptSNtIyoX4g9CNAZ2oyVhNtijlXb/k/8RSqEqH7s+pRoy2iuJuUu2DKVluPjq+5iL6LNhDXH0eOzUphOnlPBhOUAvDw/hXH3fkIpqsQx+E= Received: by 10.82.126.5 with SMTP id y5mr33366buc; Wed, 04 Oct 2006 07:20:53 -0700 (PDT) Received: by 10.82.138.15 with HTTP; Wed, 4 Oct 2006 07:20:53 -0700 (PDT) Message-ID: <85c493340610040720q2fc94461ta1835f8b230bbfd1@mail.gmail.com> Date: Wed, 4 Oct 2006 22:20:53 +0800 From: KEGan To: java-user@lucene.apache.org Subject: Re: Number Proximity Query In-Reply-To: <359a92830610040425w66d2b490t6c31e0727a7c2327@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_24347_24473878.1159971653671" References: <85c493340610031751x5ed170ebxd38f1c8475a81984@mail.gmail.com> <85c493340610040115i3f198e87g31f8f2173b0ebab7@mail.gmail.com> <359a92830610040425w66d2b490t6c31e0727a7c2327@mail.gmail.com> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_24347_24473878.1159971653671 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Erick, thanks for your reply. I have the LIA. But the sorting is not the solution I am looking for. As if I sort, I will lose out the relevancy from searches of other fields. I want the number proximity to be one in many of the fields that is searched. So the "num" field will contribute to the overall document score. ~KEGan On 10/4/06, Erick Erickson wrote: > > Sorry if this is a re-post, but I got an "undeliverable" error last time I > tried to post it, something about SPAM. The nerve of that filter! > > ---------------- > I don't have my book handy, but you might want to check out "Lucene In > Action". There's an example of how to create an index of restaurants and > execute a query that orders the responses by the distance to the closest > restaurant. > > I think a similar technique (although proabably an easier implementation) > could apply to your problem. Unfortunately, I don't remember the details > well enough to say much more.... > > Could you accomplish this by implementing your own sort? I have no real > idea > whether that's applicable, but it did occur to me...... > > Not much help, but a start . > > Erick > > On 10/4/06, KEGan wrote: > > > > Thanks Chis. > > > > After spending half a day to "really" look into FunctionQuery (and > related > > classes), and re-reading about Weight and Scorer. I think I am beginning > > to > > understand a bit. But more questions. > > > > (1) Should values returned by DocValues (return from ValueSource) must > > always betwen 1.0 and 0.0 ? How is this value affect the overall > document > > scores, assuming there are others Query clauses as well that is perform > on > > the document (on other fields). > > > > (2) The documentation on the following functions is extremely lacking > (no > > matter where I looked). Any expert here can help out ? > > > > -- Weight.getValue() : what values should be returned for > > NumberProximityQuery? > > -- Weight.sumOfSquareWeights() : no idea what is this for??? > > -- Weight.normalize() : still no idea > > -- Scorer.score() : should this value always between 1.0 and 0.0 ? > > > > > > > > Thanks. > > ~KEGan > > > > > > On 10/4/06, Chris Hostetter wrote: > > > > > > > > > : >From my searches, there seems to be a FunctionQuery in Solr that > can > > do > > > this > > > : type of query. But I am using pure Lucene, and trying to port Solr > > code > > > over > > > : (to create my own version of FunctionQuery) looks too complicated > > > because of > > > : code dependency on other Solr code such as ValueSource, etc. > > > > > > ValueSource isn't relaly "other Solr code" .. it's an inherient part > of > > > FunctionQuery (hence it's in the same package). > > > > > > You should be able to use everything in the > > > org.apache.solr.search.function package as is without any other Solr > > code. > > > > > > : I have also search on how to write my own query instance, but there > is > > > lack > > > : of documentation on doing so. The formula to calculate the number > > > proximity > > > : is quite trivial. But how to stitch together Query, Weight, Scorer > is > > > the > > > : problem :( > > > > > > Check out the package documentation for org.apache.lucene.search, > > > particularly section #3 "Changing the Scoring" ... > > > > > > > > > > > > http://lucene.apache.org/java/docs/api/org/apache/lucene/search/package-summary.html#scoring > > > > > > > > > > > > > > > -Hoss > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > > > For additional commands, e-mail: java-user-help@lucene.apache.org > > > > > > > > > > > > ------=_Part_24347_24473878.1159971653671--