lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r663054 - in /lucene/java/trunk: CHANGES.txt contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java
Date Wed, 04 Jun 2008 10:41:41 GMT
Author: gsingers
Date: Wed Jun  4 03:41:41 2008
New Revision: 663054

URL: http://svn.apache.org/viewvc?rev=663054&view=rev
Log:
LUCENE-1298: Allow MLT to use custom similarity

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=663054&r1=663053&r2=663054&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Wed Jun  4 03:41:41 2008
@@ -177,6 +177,8 @@
 
 15. LUCENE-1295: Added new method to MoreLikeThis for retrieving interesting terms and made
retrieveTerms(int) public. (Grant Ingersoll)
 
+16. LUCENE-1298: MoreLikeThis can now accept a custom Similarity (Grant Ingersoll)
+
 Optimizations
 
  1. LUCENE-705: When building a compound file, use

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java?rev=663054&r1=663053&r2=663054&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java
(original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java
Wed Jun  4 03:41:41 2008
@@ -276,7 +276,7 @@
     /**
      * For idf() calculations.
      */
-    private Similarity similarity = new DefaultSimilarity();
+    private Similarity similarity;// = new DefaultSimilarity();
 
     /**
      * IndexReader to use
@@ -287,10 +287,24 @@
      * Constructor requiring an IndexReader.
      */
     public MoreLikeThis(IndexReader ir) {
-        this.ir = ir;
+        this(ir, new DefaultSimilarity());
     }
 
-    /**
+    public MoreLikeThis(IndexReader ir, Similarity sim){
+      this.ir = ir;
+      this.similarity = sim;
+    }
+
+
+  public Similarity getSimilarity() {
+    return similarity;
+  }
+
+  public void setSimilarity(Similarity similarity) {
+    this.similarity = similarity;
+  }
+
+  /**
      * Returns an analyzer that will be used to parse source doc with. The default analyzer
      * is the {@link #DEFAULT_ANALYZER}.
      *



Mime
View raw message