lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r701437 - in /lucene/java/branches/lucene_2_4/contrib/queries/src: java/org/apache/lucene/search/FuzzyLikeThisQuery.java test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
Date Fri, 03 Oct 2008 16:40:19 GMT
Author: mikemccand
Date: Fri Oct  3 09:40:19 2008
New Revision: 701437

URL: http://svn.apache.org/viewvc?rev=701437&view=rev
Log:
merging rev 699512 (fixes bug in FuzzyLikeThisQuery matching) to 2.4 branch

Added:
    lucene/java/branches/lucene_2_4/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
      - copied unchanged from r699512, lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
Modified:
    lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java

Modified: lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java?rev=701437&r1=701436&r2=701437&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java
(original)
+++ lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java
Fri Oct  3 09:40:19 2008
@@ -141,26 +141,25 @@
                     }
                 }
                 while(fe.next());
-                if(numVariants==0)
+                if(numVariants>0)
                 {
-                    //no variants to rank here
-                    break;
+	                int avgDf=totalVariantDocFreqs/numVariants;
+	                if(df==0)//no direct match we can use as df for all variants 
+	                {
+	                    df=avgDf; //use avg df of all variants
+	                }
+	                
+	                // take the top variants (scored by edit distance) and reset the score
+	                // to include an IDF factor then add to the global queue for ranking 
+	                // overall top query terms
+	                int size = variantsQ.size();
+	                for(int i = 0; i < size; i++)
+	                {
+	                  ScoreTerm st = (ScoreTerm) variantsQ.pop();
+	                  st.score=(st.score*st.score)*sim.idf(df,corpusNumDocs);
+	                  q.insert(st);
+	                }                            
                 }
-                int avgDf=totalVariantDocFreqs/numVariants;
-                if(df==0)//no direct match we can use as df for all variants 
-                {
-                    df=avgDf; //use avg df of all variants
-                }
-                
-                // take the top variants (scored by edit distance) and reset the score
-                // to include an IDF factor then add to the global queue for ranking overall
top query terms
-                int size = variantsQ.size();
-                for(int i = 0; i < size; i++)
-                {
-                  ScoreTerm st = (ScoreTerm) variantsQ.pop();
-                  st.score=(st.score*st.score)*sim.idf(df,corpusNumDocs);
-                  q.insert(st);
-                }                            
         	}
         }     
     }



Mime
View raw message