From 4ae5fcbf536b3b2b6d9e2cc2c28a2ac837d7c6c2 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 3 Sep 2008 09:06:13 +0000 Subject: [PATCH] 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 --- src/java/org/apache/lucene/search/Searcher.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/java/org/apache/lucene/search/Searcher.java b/src/java/org/apache/lucene/search/Searcher.java index a70615561b3..b6b327dc4ba 100644 --- a/src/java/org/apache/lucene/search/Searcher.java +++ b/src/java/org/apache/lucene/search/Searcher.java @@ -136,6 +136,16 @@ public abstract class Searcher implements Searchable { return search(createWeight(query), filter, n); } + /** Finds the top n + * hits for query. + * + * @throws BooleanQuery.TooManyClauses + */ + public TopDocs search(Query query, int n) + throws IOException { + return search(query, null, n); + } + /** Returns an Explanation that describes how doc scored against * query. *