Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 09D8E29A2 for ; Tue, 3 May 2011 14:30:02 +0000 (UTC) Received: (qmail 91996 invoked by uid 500); 3 May 2011 14:29:58 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 91937 invoked by uid 500); 3 May 2011 14:29:58 -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 91900 invoked by uid 99); 3 May 2011 14:29:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 14:29:58 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul_t100@fastmail.fm designates 66.111.4.26 as permitted sender) Received: from [66.111.4.26] (HELO out2.smtp.messagingengine.com) (66.111.4.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 14:29:51 +0000 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 56437208E6; Tue, 3 May 2011 10:29:30 -0400 (EDT) Received: from frontend2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 03 May 2011 10:29:30 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:reply-to:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=yAEGjiVK46otCY0/6GiBuqU8eN8=; b=iOfCcJJvMEQqw7tczYQ0+EHfODFWIF6ywvITEfqn3WKwiFdkpVnaksbbULQxm4rYjDP5GRMebFPUKqtyaWzgRph4jXD+u7odglpu8hg8MzDJfG/1F6gqSr/rDHw2EFX6pEaPFGz0j96Wu+xOtxJMXtLVWI5I90TGlxvxQI6KstI= X-Sasl-enc: mN2T0Squlro30X0bUKzIqfVUC9hgmeY8haJu7d5TV3FT 1304432969 Received: from [192.168.1.66] (unknown [217.155.98.246]) by mail.messagingengine.com (Postfix) with ESMTPSA id 59B23446C45; Tue, 3 May 2011 10:29:29 -0400 (EDT) Message-ID: <4DC01148.7030704@fastmail.fm> Date: Tue, 03 May 2011 15:29:28 +0100 From: Paul Taylor Reply-To: paul_t100@fastmail.fm User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Robert Muir CC: java-user@lucene.apache.org Subject: Re: Problem modifying Similarity class to work with lucene 3.1.0 References: <4DC009AF.6070508@fastmail.fm> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 03/05/2011 15:06, Robert Muir wrote: > On Tue, May 3, 2011 at 9:57 AM, Paul Taylor wrote: >> How can I convert this Similariity method to use 3.1 (currently using >> 3.0.3), I understand I have to replace lengthNorm() wuth computerNorm() , >> but fieldlName is not a provided parameter in computerNorm() and >> FieldInvertState does not contain the fieldname either. > Hi, I think you made a mistake, it does take fieldname: > > http://lucene.apache.org/java/3_1_0/api/core/org/apache/lucene/search/Similarity.html#computeNorm(java.lang.String, > org.apache.lucene.index.FieldInvertState) > Doh thanks, not having a good few days, trying to do to much at once. I assume this would be the correct way to fix the code for 3.1.0 public float computeNorm(String field, FieldInvertState state) { //This will match both artist and label aliases and is applicable to both, didn't use the constant //ArtistIndexField.ALIAS because that would be confusing if (field.equals("alias")) { return state.getBoost() * 0.578f; //Same result as normal calc if field had three terms the most common scenario } else { return super.computeNorm(field,state); } } Paul --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org