LUCENE-1973: un-deprecate IndexSearcher.setDefaultFieldSortScoring

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@829882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-10-26 18:04:22 +00:00
parent 74f872182e
commit 6a1f2d5729
4 changed files with 20 additions and 7 deletions

View File

@ -103,6 +103,10 @@ API Changes
of 2.9) enablePositionIncrements to true to match of 2.9) enablePositionIncrements to true to match
StandardAnalyzer's 2.9 default (Uwe Schindler, Mike McCandless) StandardAnalyzer's 2.9 default (Uwe Schindler, Mike McCandless)
* LUCENE-1973: Un-deprecate IndexSearcher.setDefaultFieldSortScoring,
to allow controlling per-IndexSearcher whether scores are computed
when sorting by field. (Uwe Schindler, Mike McCandless)
Bug fixes Bug fixes
* LUCENE-1951: When the text provided to WildcardQuery has no wildcard * LUCENE-1951: When the text provided to WildcardQuery has no wildcard

View File

@ -270,7 +270,18 @@ public class IndexSearcher extends Searcher {
private boolean fieldSortDoTrackScores; private boolean fieldSortDoTrackScores;
private boolean fieldSortDoMaxScore; private boolean fieldSortDoMaxScore;
/** @deprecated */ /** By default, no scores are computed when sorting by
* field (using {@link #search(Query,Filter,int,Sort)}).
* You can change that, per IndexSearcher instance, by
* calling this method. Note that this will incur a CPU
* cost.
*
* @param doTrackScores If true, then scores are
* returned for every matching document in {@link
* TopFieldDocs}.
*
* @param doMaxScore If true, then the max score for all
* matching docs is computed. */
public void setDefaultFieldSortScoring(boolean doTrackScores, boolean doMaxScore) { public void setDefaultFieldSortScoring(boolean doTrackScores, boolean doMaxScore) {
fieldSortDoTrackScores = doTrackScores; fieldSortDoTrackScores = doTrackScores;
fieldSortDoMaxScore = doMaxScore; fieldSortDoMaxScore = doMaxScore;

View File

@ -155,7 +155,7 @@ public interface Searchable extends Closeable {
* <code>sort</code>. * <code>sort</code>.
* *
* <p>Applications should usually call {@link * <p>Applications should usually call {@link
* Searcher#search(Query,Filter,Sort)} instead. * Searcher#search(Query,Filter,int,Sort)} instead.
* *
* @throws BooleanQuery.TooManyClauses * @throws BooleanQuery.TooManyClauses
*/ */

View File

@ -37,11 +37,9 @@ public abstract class Searcher implements Searchable {
* <code>filter</code> if non-null, and sorting the hits by the criteria in * <code>filter</code> if non-null, and sorting the hits by the criteria in
* <code>sort</code>. * <code>sort</code>.
* *
* <p>NOTE: this does not compute scores by default. If * <p>NOTE: this does not compute scores by default; use
* you need scores, create a {@link TopFieldCollector} * {@link IndexSearcher#setDefaultFieldSortScoring} to
* instance by calling {@link TopFieldCollector#create} * enable scoring.
* and then pass that to {@link #search(Query, Filter,
* Collector)}.</p>
* *
* @throws BooleanQuery.TooManyClauses * @throws BooleanQuery.TooManyClauses
*/ */