mirror of https://github.com/apache/lucene.git
revert latest commit accidentially added sysouts
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1421792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80ad45689a
commit
dbd3ce549f
|
@ -157,10 +157,7 @@ public class CommonTermsQuery extends Query {
|
||||||
final TermContext[] contextArray = new TermContext[terms.size()];
|
final TermContext[] contextArray = new TermContext[terms.size()];
|
||||||
final Term[] queryTerms = this.terms.toArray(new Term[0]);
|
final Term[] queryTerms = this.terms.toArray(new Term[0]);
|
||||||
collectTermContext(reader, leaves, contextArray, queryTerms);
|
collectTermContext(reader, leaves, contextArray, queryTerms);
|
||||||
Query q = buildQuery(maxDoc, contextArray, queryTerms);
|
return buildQuery(maxDoc, contextArray, queryTerms);
|
||||||
System.out.println(reader);
|
|
||||||
System.out.println(q);
|
|
||||||
return q;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Query buildQuery(final int maxDoc,
|
protected Query buildQuery(final int maxDoc,
|
||||||
|
@ -175,20 +172,15 @@ public class CommonTermsQuery extends Query {
|
||||||
BooleanQuery query = new BooleanQuery(true);
|
BooleanQuery query = new BooleanQuery(true);
|
||||||
for (int i = 0; i < queryTerms.length; i++) {
|
for (int i = 0; i < queryTerms.length; i++) {
|
||||||
TermContext termContext = contextArray[i];
|
TermContext termContext = contextArray[i];
|
||||||
|
|
||||||
if (termContext == null) {
|
if (termContext == null) {
|
||||||
System.out.println("term: " + queryTerms[i] + " context: " + -1 + " maxTermFrequency: " + maxTermFrequency + " LOW");
|
|
||||||
|
|
||||||
lowFreq.add(new TermQuery(queryTerms[i]), lowFreqOccur);
|
lowFreq.add(new TermQuery(queryTerms[i]), lowFreqOccur);
|
||||||
} else {
|
} else {
|
||||||
if ((maxTermFrequency >= 1f && termContext.docFreq() > maxTermFrequency)
|
if ((maxTermFrequency >= 1f && termContext.docFreq() > maxTermFrequency)
|
||||||
|| (termContext.docFreq() > (int) Math.ceil(maxTermFrequency
|
|| (termContext.docFreq() > (int) Math.ceil(maxTermFrequency
|
||||||
* (float) maxDoc))) {
|
* (float) maxDoc))) {
|
||||||
System.out.println("term: " + queryTerms[i] + " context: " + termContext.docFreq() + " maxTermFrequency: " + maxTermFrequency + " HIGH");
|
|
||||||
highFreq
|
highFreq
|
||||||
.add(new TermQuery(queryTerms[i], termContext), highFreqOccur);
|
.add(new TermQuery(queryTerms[i], termContext), highFreqOccur);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("term: " + queryTerms[i] + " context: " + termContext.docFreq() + " maxTermFrequency: " + maxTermFrequency + " LOW");
|
|
||||||
lowFreq.add(new TermQuery(queryTerms[i], termContext), lowFreqOccur);
|
lowFreq.add(new TermQuery(queryTerms[i], termContext), lowFreqOccur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,6 +257,8 @@ public class CommonTermsQuery extends Query {
|
||||||
* Returns true iff {@link Similarity#coord(int,int)} is disabled in scoring
|
* Returns true iff {@link Similarity#coord(int,int)} is disabled in scoring
|
||||||
* for the high and low frequency query instance. The top level query will
|
* for the high and low frequency query instance. The top level query will
|
||||||
* always disable coords.
|
* always disable coords.
|
||||||
|
*
|
||||||
|
* @see #CommonTermsQuery(Occur, Occur, float, boolean)
|
||||||
*/
|
*/
|
||||||
public boolean isCoordDisabled() {
|
public boolean isCoordDisabled() {
|
||||||
return disableCoord;
|
return disableCoord;
|
||||||
|
|
|
@ -263,6 +263,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
TopDocs cqSearch = searcher.search(cq, reader.maxDoc());
|
TopDocs cqSearch = searcher.search(cq, reader.maxDoc());
|
||||||
|
QueryUtils.check(random(), cq, searcher);
|
||||||
|
|
||||||
TopDocs verifySearch = searcher.search(verifyQuery, reader.maxDoc());
|
TopDocs verifySearch = searcher.search(verifyQuery, reader.maxDoc());
|
||||||
assertEquals(verifySearch.totalHits, cqSearch.totalHits);
|
assertEquals(verifySearch.totalHits, cqSearch.totalHits);
|
||||||
|
@ -276,18 +277,6 @@ public class CommonTermsQueryTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(hits.isEmpty());
|
assertTrue(hits.isEmpty());
|
||||||
|
|
||||||
/*
|
|
||||||
* need to force merge here since QueryUtils adds checks based
|
|
||||||
* on leave readers which have different statistics than the top
|
|
||||||
* level reader if we have more than one segment. This could
|
|
||||||
* result in a different query / results.
|
|
||||||
*/
|
|
||||||
w.forceMerge(1);
|
|
||||||
DirectoryReader reader2 = w.getReader();
|
|
||||||
QueryUtils.check(random(), cq, newSearcher(reader2));
|
|
||||||
reader2.close();
|
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
reader.close();
|
reader.close();
|
||||||
wrapper.close();
|
wrapper.close();
|
||||||
|
|
Loading…
Reference in New Issue