org.apache.lucene.search

Class IndexSearcher

public class IndexSearcher extends Searcher

Implements search over a single IndexReader.

Applications usually need only call the inherited {@link #search(Query)} or {@link #search(Query,Filter)} methods.

Constructor Summary
IndexSearcher(String path)
Creates a searcher searching the index in the named directory.
IndexSearcher(Directory directory)
Creates a searcher searching the index in the provided directory.
IndexSearcher(IndexReader r)
Creates a searcher searching the provided index.
Method Summary
voidclose()
Note that the underlying IndexReader is not closed, if IndexSearcher was constructed with IndexSearcher(IndexReader r).
Documentdoc(int i)
intdocFreq(Term term)
Explanationexplain(Query query, int doc)
intmaxDoc()
Queryrewrite(Query original)
TopDocssearch(Query query, Filter filter, int nDocs)
TopFieldDocssearch(Query query, Filter filter, int nDocs, Sort sort)
voidsearch(Query query, Filter filter, HitCollector results)

Constructor Detail

IndexSearcher

public IndexSearcher(String path)
Creates a searcher searching the index in the named directory.

IndexSearcher

public IndexSearcher(Directory directory)
Creates a searcher searching the index in the provided directory.

IndexSearcher

public IndexSearcher(IndexReader r)
Creates a searcher searching the provided index.

Method Detail

close

public void close()
Note that the underlying IndexReader is not closed, if IndexSearcher was constructed with IndexSearcher(IndexReader r). If the IndexReader was supplied implicitly by specifying a directory, then the IndexReader gets closed.

doc

public Document doc(int i)

docFreq

public int docFreq(Term term)

explain

public Explanation explain(Query query, int doc)

maxDoc

public int maxDoc()

rewrite

public Query rewrite(Query original)

search

public TopDocs search(Query query, Filter filter, int nDocs)

search

public TopFieldDocs search(Query query, Filter filter, int nDocs, Sort sort)

search

public void search(Query query, Filter filter, HitCollector results)
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.