private TopDocs Correlation_Adjust(TopDocs td, double c) throws IOException {
double log2toe = 1.0d / Math.log(2.0d);
TopDocs f_td = td;
ScoreDoc temp[] = f_td.scoreDocs;
// System.out.println("number: "+temp.length);
TopDocCollector collector = null;
for (int d = 0; d < 19; d++) {
collector = new TopDocCollector(temp.length);
for (int j = 0; j <= d; j++) {
collector.collect(temp[j].doc, temp[j].score + 100.0d);
}
for (int i = d + 1; i < temp.length; i++) {
temp[i].score -= c / Math.log(d + 2) / log2toe
* correlation(temp[d].doc, temp[i].doc);
// c *correlation(temp[d].doc,temp[i].doc);
// System.out.println(temp[d].doc+" "+temp[i].doc);
// System.out.println("Score: "+temp[i].score +
// " Correlation: "+correlation(temp[d].doc,temp[i].doc));
collector.collect(temp[i].doc, temp[i].score);
}
f_td = collector.topDocs();
temp = f_td.scoreDocs;
}
return f_td;
}