Lucene++ - a full-featured, c++ search engine
API Documentation


Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
Lucene::Searchable Class Referenceabstract

The interface for search implementations. More...

#include <Searchable.h>

+ Inheritance diagram for Lucene::Searchable:

Public Member Functions

virtual String getClassName ()
 
virtual ~Searchable ()
 
virtual void search (const WeightPtr &weight, const FilterPtr &filter, const CollectorPtr &collector)=0
 Lower-level search API.
 
virtual void close ()=0
 Frees resources associated with this Searcher. Be careful not to call this method while you are still using objects that reference this Searchable.
 
virtual int32_t docFreq (const TermPtr &term)=0
 Returns the number of documents containing term.
 
virtual Collection< int32_t > docFreqs (Collection< TermPtr > terms)=0
 For each term in the terms array, calculates the number of documents containing term. Returns an array with these document frequencies. Used to minimize number of remote calls.
 
virtual int32_t maxDoc ()=0
 Returns one greater than the largest possible document number.
 
virtual TopDocsPtr search (const WeightPtr &weight, const FilterPtr &filter, int32_t n)=0
 Low-level search implementation. Finds the top n hits for query, applying filter if non-null. Applications should usually call Searcher#search(QueryPtr, int32_t) or Searcher#search(QueryPtr, FilterPtr, int32_t) instead.
 
virtual DocumentPtr doc (int32_t n)=0
 Returns the stored fields of document i.
 
virtual DocumentPtr doc (int32_t n, const FieldSelectorPtr &fieldSelector)=0
 Get the Document at the n'th position. The FieldSelector may be used to determine what Fields to load and how they should be loaded.
 
virtual QueryPtr rewrite (const QueryPtr &query)=0
 Called to re-write queries into primitive queries.
 
virtual ExplanationPtr explain (const WeightPtr &weight, int32_t doc)=0
 Low-level implementation method. Returns an Explanation that describes how doc scored against weight.
 
virtual TopFieldDocsPtr search (const WeightPtr &weight, const FilterPtr &filter, int32_t n, const SortPtr &sort)=0
 Low-level search implementation with arbitrary sorting. Finds the top n hits for query, applying filter if non-null, and sorting the hits by the criteria in sort.
 

Static Public Member Functions

static String _getClassName ()
 

Detailed Description

The interface for search implementations.

Searchable is the abstract network protocol for searching. Implementations provide search over a single index, over multiple indices, and over indices on remote servers.

Queries, filters and sort criteria are designed to be compact so that they may be efficiently passed to a remote index, with only the top-scoring hits being returned, rather than every matching hit.

NOTE: this interface is kept public for convenience. Since it is not expected to be implemented directly, it may be changed unexpectedly between releases.

Constructor & Destructor Documentation

◆ ~Searchable()

virtual Lucene::Searchable::~Searchable ( )
inlinevirtual

Member Function Documentation

◆ _getClassName()

static String Lucene::Searchable::_getClassName ( )
inlinestatic

◆ close()

virtual void Lucene::Searchable::close ( )
pure virtual

Frees resources associated with this Searcher. Be careful not to call this method while you are still using objects that reference this Searchable.

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.

◆ doc() [1/2]

virtual DocumentPtr Lucene::Searchable::doc ( int32_t  n)
pure virtual

Returns the stored fields of document i.

See also
IndexReader::document(int32_t)

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.

◆ doc() [2/2]

virtual DocumentPtr Lucene::Searchable::doc ( int32_t  n,
const FieldSelectorPtr fieldSelector 
)
pure virtual

Get the Document at the n'th position. The FieldSelector may be used to determine what Fields to load and how they should be loaded.

NOTE: If the underlying Reader (more specifically, the underlying FieldsReader) is closed before the lazy Field is loaded an exception may be thrown. If you want the value of a lazy Field to be available after closing you must explicitly load it or fetch the Document again with a new loader.

Parameters
nGet the document at the n'th position
fieldSelectorThe FieldSelector to use to determine what Fields should be loaded on the Document. May be null, in which case all Fields will be loaded.
Returns
The stored fields of the Document at the n'th position
See also
IndexReader::document(int32_t, FieldSelectorPtr)
Fieldable
FieldSelector
SetBasedFieldSelector
LoadFirstFieldSelector

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.

◆ docFreq()

virtual int32_t Lucene::Searchable::docFreq ( const TermPtr term)
pure virtual

Returns the number of documents containing term.

See also
IndexReader::docFreq(TermPtr)

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, Lucene::ParallelMultiSearcher, and Lucene::Searcher.

◆ docFreqs()

virtual Collection< int32_t > Lucene::Searchable::docFreqs ( Collection< TermPtr terms)
pure virtual

For each term in the terms array, calculates the number of documents containing term. Returns an array with these document frequencies. Used to minimize number of remote calls.

Implemented in Lucene::Searcher.

◆ explain()

virtual ExplanationPtr Lucene::Searchable::explain ( const WeightPtr weight,
int32_t  doc 
)
pure virtual

Low-level implementation method. Returns an Explanation that describes how doc scored against weight.

This is intended to be used in developing Similarity implementations, and for good performance, should not be displayed with every hit. Computing an explanation is as expensive as executing the query over the entire index.

Applications should call Searcher#explain(QueryPtr, int32_t).

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, Lucene::IndexSearcher, and Lucene::Searcher.

◆ getClassName()

virtual String Lucene::Searchable::getClassName ( )
inlinevirtual

◆ maxDoc()

virtual int32_t Lucene::Searchable::maxDoc ( )
pure virtual

Returns one greater than the largest possible document number.

See also
IndexReader::maxDoc()

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.

◆ rewrite()

virtual QueryPtr Lucene::Searchable::rewrite ( const QueryPtr query)
pure virtual

Called to re-write queries into primitive queries.

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.

◆ search() [1/3]

virtual void Lucene::Searchable::search ( const WeightPtr weight,
const FilterPtr filter,
const CollectorPtr collector 
)
pure virtual

Lower-level search API.

Collector#collect(int32_t) is called for every document. Collector-based access to remote indexes is discouraged.

Applications should only use this if they need all of the matching documents. The high-level search API (Searcher#search(QueryPtr, int32_t)) is usually more efficient, as it skips non-high-scoring hits.

Parameters
weightTo match documents
filterIf non-null, used to permit documents to be collected.
collectorTo receive hits

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.

◆ search() [2/3]

virtual TopDocsPtr Lucene::Searchable::search ( const WeightPtr weight,
const FilterPtr filter,
int32_t  n 
)
pure virtual

Low-level search implementation. Finds the top n hits for query, applying filter if non-null. Applications should usually call Searcher#search(QueryPtr, int32_t) or Searcher#search(QueryPtr, FilterPtr, int32_t) instead.

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, Lucene::ParallelMultiSearcher, Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.

◆ search() [3/3]

virtual TopFieldDocsPtr Lucene::Searchable::search ( const WeightPtr weight,
const FilterPtr filter,
int32_t  n,
const SortPtr sort 
)
pure virtual

Low-level search implementation with arbitrary sorting. Finds the top n hits for query, applying filter if non-null, and sorting the hits by the criteria in sort.

Applications should usually call Searcher#search(QueryPtr, FilterPtr, int32_t, SortPtr) instead.

Implemented in Lucene::IndexSearcher, Lucene::MultiSearcher, Lucene::ParallelMultiSearcher, Lucene::IndexSearcher, Lucene::MultiSearcher, and Lucene::Searcher.


The documentation for this class was generated from the following file:

clucene.sourceforge.net