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)
|
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
|
Optimizations
|
||||||
|
|
||||||
1. LUCENE-705: When building a compound file, use
|
1. LUCENE-705: When building a compound file, use
|
||||||
|
|
|
@ -276,7 +276,7 @@ public final class MoreLikeThis {
|
||||||
/**
|
/**
|
||||||
* For idf() calculations.
|
* For idf() calculations.
|
||||||
*/
|
*/
|
||||||
private Similarity similarity = new DefaultSimilarity();
|
private Similarity similarity;// = new DefaultSimilarity();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IndexReader to use
|
* IndexReader to use
|
||||||
|
@ -287,10 +287,24 @@ public final class MoreLikeThis {
|
||||||
* Constructor requiring an IndexReader.
|
* Constructor requiring an IndexReader.
|
||||||
*/
|
*/
|
||||||
public MoreLikeThis(IndexReader ir) {
|
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
|
* Returns an analyzer that will be used to parse source doc with. The default analyzer
|
||||||
* is the {@link #DEFAULT_ANALYZER}.
|
* is the {@link #DEFAULT_ANALYZER}.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue