mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
SEARCH-2247 Remove all unused and commented code from AbstractAuthorityQueryWeight.
Use this tidying as an oportunity to test the community mirroring.
This commit is contained in:
+5
-21
@@ -24,12 +24,9 @@ import org.apache.lucene.index.IndexReaderContext;
|
|||||||
import org.apache.lucene.index.LeafReaderContext;
|
import org.apache.lucene.index.LeafReaderContext;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.TermContext;
|
import org.apache.lucene.index.TermContext;
|
||||||
import org.apache.lucene.search.CollectionStatistics;
|
|
||||||
import org.apache.lucene.search.Explanation;
|
import org.apache.lucene.search.Explanation;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.TermStatistics;
|
|
||||||
import org.apache.lucene.search.Weight;
|
import org.apache.lucene.search.Weight;
|
||||||
import org.apache.lucene.search.similarities.TFIDFSimilarity;
|
|
||||||
import org.apache.solr.search.SolrIndexSearcher;
|
import org.apache.solr.search.SolrIndexSearcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,37 +38,29 @@ public abstract class AbstractAuthorityQueryWeight extends Weight
|
|||||||
{
|
{
|
||||||
protected Query query;
|
protected Query query;
|
||||||
protected SolrIndexSearcher searcher;
|
protected SolrIndexSearcher searcher;
|
||||||
protected TFIDFSimilarity similarity;
|
|
||||||
protected float value;
|
protected float value;
|
||||||
protected float idf;
|
|
||||||
protected float queryNorm;
|
|
||||||
protected float queryWeight;
|
|
||||||
protected Explanation idfExp;
|
|
||||||
protected boolean needsScores;
|
protected boolean needsScores;
|
||||||
|
|
||||||
public AbstractAuthorityQueryWeight(SolrIndexSearcher searcher, boolean needsScores, Query query, String authTermName, String authTermText) throws IOException
|
public AbstractAuthorityQueryWeight(SolrIndexSearcher searcher, boolean needsScores, Query query, String authTermName, String authTermText) throws IOException
|
||||||
{
|
{
|
||||||
super(query);
|
super(query);
|
||||||
this.searcher = searcher;
|
this.searcher = searcher;
|
||||||
//this.similarity = (TFIDFSimilarity) searcher.getSimilarity(true);
|
searcher.collectionStatistics(authTermName);
|
||||||
CollectionStatistics collectionStats = searcher.collectionStatistics(authTermName);
|
|
||||||
final IndexReaderContext context = searcher.getTopReaderContext();
|
final IndexReaderContext context = searcher.getTopReaderContext();
|
||||||
final Term term = new Term(authTermName, authTermText);
|
final Term term = new Term(authTermName, authTermText);
|
||||||
final TermContext termContext = TermContext.build(context, term);
|
final TermContext termContext = TermContext.build(context, term);
|
||||||
TermStatistics termStats = searcher.termStatistics(term, termContext);
|
searcher.termStatistics(term, termContext);
|
||||||
//idfExp = similarity.idfExplain(collectionStats, termStats);
|
|
||||||
//idf = idfExp.getValue();
|
|
||||||
this.needsScores = needsScores;
|
this.needsScores = needsScores;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Explanation explain(LeafReaderContext context, int doc) throws IOException
|
public Explanation explain(LeafReaderContext context, int doc)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getValueForNormalization() throws IOException
|
public float getValueForNormalization()
|
||||||
{
|
{
|
||||||
return sumOfSquaredWeights();
|
return sumOfSquaredWeights();
|
||||||
}
|
}
|
||||||
@@ -79,15 +68,10 @@ public abstract class AbstractAuthorityQueryWeight extends Weight
|
|||||||
@Override
|
@Override
|
||||||
public void normalize(float queryNorm, float topLevelBoost)
|
public void normalize(float queryNorm, float topLevelBoost)
|
||||||
{
|
{
|
||||||
//this.queryNorm = queryNorm;
|
|
||||||
//queryWeight *= queryNorm; // normalize query weight
|
|
||||||
//value = queryWeight * idf; // idf for document
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float sumOfSquaredWeights() throws IOException
|
protected float sumOfSquaredWeights()
|
||||||
{
|
{
|
||||||
//queryWeight = idf; // compute query weight
|
|
||||||
//return queryWeight * queryWeight; // square it
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user