add search method that allows Sort, but doesn't require a Filter

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1021360 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Grant Ingersoll 2010-10-11 14:45:11 +00:00
parent 8887a044ea
commit 98b20d6479
1 changed files with 13 additions and 0 deletions

View File

@ -49,6 +49,19 @@ public abstract class Searcher implements Searchable {
return search(createWeight(query), filter, n, sort);
}
/**
* Search implementation with arbitrary sorting and no filter.
* @param query The query to search for
* @param n Return only the top n results
* @param sort The {@link org.apache.lucene.search.Sort} object
* @return The top docs, sorted according to the supplied {@link org.apache.lucene.search.Sort} instance
* @throws IOException
*/
public TopFieldDocs search(Query query, int n,
Sort sort) throws IOException {
return search(createWeight(query), null, n, sort);
}
/** Lower-level search API.
*
* <p>{@link Collector#collect(int)} is called for every matching document.