Added more logging

This commit is contained in:
Martijn van Groningen 2014-03-12 14:51:11 +07:00
parent 39d2377be6
commit c841aa296a
2 changed files with 5 additions and 4 deletions

View File

@ -90,8 +90,8 @@ public class TopChildrenQuery extends Query {
} }
// Rewrite invocation logic: // Rewrite invocation logic:
// 1) query_then_fetch (default): Rewrite is execute as part of the createWeight invocation, when search child docs. // 1) query_then|and_fetch (default): Rewrite is execute as part of the createWeight invocation, when search child docs.
// 2) dfs_query_then_fetch:: First rewrite and then createWeight is executed. During query phase rewrite isn't // 2) dfs_query_then|and_fetch:: First rewrite and then createWeight is executed. During query phase rewrite isn't
// executed any more because searchContext#queryRewritten() returns true. // executed any more because searchContext#queryRewritten() returns true.
@Override @Override
public Query rewrite(IndexReader reader) throws IOException { public Query rewrite(IndexReader reader) throws IOException {
@ -127,7 +127,7 @@ public class TopChildrenQuery extends Query {
if (rewrittenChildQuery == null) { if (rewrittenChildQuery == null) {
childQuery = rewrittenChildQuery = searcher.rewrite(originalChildQuery); childQuery = rewrittenChildQuery = searcher.rewrite(originalChildQuery);
} else { } else {
assert rewriteIndexReader == searcher.getIndexReader(); assert rewriteIndexReader == searcher.getIndexReader() : "not equal, rewriteIndexReader=" + rewriteIndexReader + " searcher.getIndexReader()=" + searcher.getIndexReader();
childQuery = rewrittenChildQuery; childQuery = rewrittenChildQuery;
} }

View File

@ -319,7 +319,8 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
} }
flushAndRefresh(); flushAndRefresh();
for (int i = 0; i < 10; i++) { for (int i = 1; i <= 10; i++) {
logger.info("Round {}", i);
SearchResponse searchResponse = client().prepareSearch("test") SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(constantScoreQuery(queryFilter(topChildrenQuery("child", matchAllQuery())).cache(true))).execute() .setQuery(constantScoreQuery(queryFilter(topChildrenQuery("child", matchAllQuery())).cache(true))).execute()
.actionGet(); .actionGet();