mirror of https://github.com/apache/lucene.git
LUCENE-1298: Allow MLT to use custom similarity
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@663054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
455afb322d
commit
f89cda6dde
|
@ -177,6 +177,8 @@ New features
|
|||
|
||||
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
|
||||
|
|
|
@ -276,7 +276,7 @@ public final class MoreLikeThis {
|
|||
/**
|
||||
* For idf() calculations.
|
||||
*/
|
||||
private Similarity similarity = new DefaultSimilarity();
|
||||
private Similarity similarity;// = new DefaultSimilarity();
|
||||
|
||||
/**
|
||||
* IndexReader to use
|
||||
|
@ -287,7 +287,21 @@ public final class MoreLikeThis {
|
|||
* Constructor requiring an IndexReader.
|
||||
*/
|
||||
public MoreLikeThis(IndexReader 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue