LUCENE-1371: add convenience method TopDocs Searcher.search(Query query, int n)

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@691549 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2008-09-03 09:06:13 +00:00
parent 120d01bb09
commit 4ae5fcbf53
1 changed files with 10 additions and 0 deletions

View File

@ -136,6 +136,16 @@ public abstract class Searcher implements Searchable {
return search(createWeight(query), filter, n); return search(createWeight(query), filter, n);
} }
/** Finds the top <code>n</code>
* hits for <code>query</code>.
*
* @throws BooleanQuery.TooManyClauses
*/
public TopDocs search(Query query, int n)
throws IOException {
return search(query, null, n);
}
/** Returns an Explanation that describes how <code>doc</code> scored against /** Returns an Explanation that describes how <code>doc</code> scored against
* <code>query</code>. * <code>query</code>.
* *