LUCENE-5020: Make DrillSidewaysResult ctor public

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1486872 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2013-05-28 11:23:05 +00:00
parent eee9bd713f
commit 90dd61de5c
1 changed files with 10 additions and 8 deletions

View File

@ -410,8 +410,7 @@ public class DrillSideways {
doMaxScore,
true);
DrillSidewaysResult r = search(query, hitCollector, fsp);
r.hits = hitCollector.topDocs();
return r;
return new DrillSidewaysResult(r.facetResults, hitCollector.topDocs());
} else {
return search(after, query, topN, fsp);
}
@ -425,8 +424,7 @@ public class DrillSideways {
DrillDownQuery query, int topN, FacetSearchParams fsp) throws IOException {
TopScoreDocCollector hitCollector = TopScoreDocCollector.create(Math.min(topN, searcher.getIndexReader().maxDoc()), after, true);
DrillSidewaysResult r = search(query, hitCollector, fsp);
r.hits = hitCollector.topDocs();
return r;
return new DrillSidewaysResult(r.facetResults, hitCollector.topDocs());
}
/** Override this to use a custom drill-down {@link
@ -454,16 +452,20 @@ public class DrillSideways {
return false;
}
/** Represents the returned result from a drill sideways
* search. */
/**
* Represents the returned result from a drill sideways search. Note that if
* you called
* {@link DrillSideways#search(DrillDownQuery, Collector, FacetSearchParams)},
* then {@link #hits} will be {@code null}.
*/
public static class DrillSidewaysResult {
/** Combined drill down & sideways results. */
public final List<FacetResult> facetResults;
/** Hits. */
public TopDocs hits;
public final TopDocs hits;
DrillSidewaysResult(List<FacetResult> facetResults, TopDocs hits) {
public DrillSidewaysResult(List<FacetResult> facetResults, TopDocs hits) {
this.facetResults = facetResults;
this.hits = hits;
}