Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 42507 invoked from network); 8 Mar 2010 19:20:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Mar 2010 19:20:14 -0000 Received: (qmail 50259 invoked by uid 500); 8 Mar 2010 19:19:49 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 50215 invoked by uid 500); 8 Mar 2010 19:19:49 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 50208 invoked by uid 99); 8 Mar 2010 19:19:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Mar 2010 19:19:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Mar 2010 19:19:47 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 77A23234C48D for ; Mon, 8 Mar 2010 19:19:27 +0000 (UTC) Message-ID: <689064692.140791268075967489.JavaMail.jira@brutus.apache.org> Date: Mon, 8 Mar 2010 19:19:27 +0000 (UTC) From: "Robert Muir (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-124) Fuzzy Searches do not get a boost of 0.2 as stated in "Query Syntax" doc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842776#action_12842776 ] Robert Muir commented on LUCENE-124: ------------------------------------ Thanks Mike. I will commit later today if no one objects. > Fuzzy Searches do not get a boost of 0.2 as stated in "Query Syntax" doc > ------------------------------------------------------------------------ > > Key: LUCENE-124 > URL: https://issues.apache.org/jira/browse/LUCENE-124 > Project: Lucene - Java > Issue Type: Bug > Components: Search > Affects Versions: 1.2 > Environment: Operating System: All > Platform: All > Reporter: Cormac Twomey > Assignee: Robert Muir > Priority: Minor > Attachments: LUCENE-124.patch, LUCENE-124.patch > > > According to the website's "Query Syntax" page, fuzzy searches are given a > boost of 0.2. I've found this not to be the case, and have seen situations where > exact matches have lower relevance scores than fuzzy matches. > Rather than getting a boost of 0.2, it appears that all variations on the term > are first found in the model, where dist* > 0.5. > * dist = levenshteinDistance / length of min(termlength, variantlength) > This then leads to a boolean OR search of all the variant terms, each of whose > boost is set to (dist - 0.5)*2 for that variant. > The upshot of all of this is that there are many cases where a fuzzy match will > get a higher relevance score than an exact match. > See this email for a test case to reproduce this anomalous behaviour. > http://www.mail-archive.com/lucene-dev@jakarta.apache.org/msg02819.html > Here is a candidate patch to address the issue - > *** lucene-1.2\src\java\org\apache\lucene\search\FuzzyTermEnum.java Sun Jun 09 > 13:47:54 2002 > --- lucene-1.2-modified\src\java\org\apache\lucene\search\FuzzyTermEnum.java Fri > Mar 14 11:37:20 2003 > *************** > *** 99,105 **** > } > > final protected float difference() { > ! return (float)((distance - FUZZY_THRESHOLD) * SCALE_FACTOR); > } > > final public boolean endEnum() { > --- 99,109 ---- > } > > final protected float difference() { > ! if (distance == 1.0) { > ! return 1.0f; > ! } > ! else > ! return (float)((distance - FUZZY_THRESHOLD) * SCALE_FACTOR); > } > > final public boolean endEnum() { > *************** > *** 111,117 **** > ******************************/ > > public static final double FUZZY_THRESHOLD = 0.5; > ! public static final double SCALE_FACTOR = 1.0f / (1.0f - FUZZY_THRESHOLD); > > /** > Finds and returns the smallest of three integers > --- 115,121 ---- > ******************************/ > > public static final double FUZZY_THRESHOLD = 0.5; > ! public static final double SCALE_FACTOR = 0.2f * (1.0f / (1.0f - > FUZZY_THRESHOLD)); > > /** > Finds and returns the smallest of three integers -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org