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

Searcher.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef SEARCHER_H
8 #define SEARCHER_H
9
10 #include "Searchable.h"
11
12 namespace Lucene {
13
18 class LPPAPI Searcher : public Searchable, public LuceneObject {
19 public:
20 Searcher();
21 virtual ~Searcher();
22
23 LUCENE_CLASS(Searcher);
24
25 protected:
27 SimilarityPtr similarity;
28
29 public:
35 virtual TopFieldDocsPtr search(const QueryPtr& query, const FilterPtr& filter, int32_t n, const SortPtr& sort);
36
47 virtual void search(const QueryPtr& query, const CollectorPtr& results);
48
61 virtual void search(const QueryPtr& query, const FilterPtr& filter, const CollectorPtr& results);
62
64 virtual TopDocsPtr search(const QueryPtr& query, const FilterPtr& filter, int32_t n);
65
67 virtual TopDocsPtr search(const QueryPtr& query, int32_t n);
68
74 virtual ExplanationPtr explain(const QueryPtr& query, int32_t doc);
75
77 virtual void setSimilarity(const SimilarityPtr& similarity);
78
82 virtual SimilarityPtr getSimilarity();
83
84 virtual Collection<int32_t> docFreqs(Collection<TermPtr> terms);
85
86 virtual void search(const WeightPtr& weight, const FilterPtr& filter, const CollectorPtr& results) = 0;
87 virtual void close() = 0;
88 virtual int32_t docFreq(const TermPtr& term) = 0;
89 virtual int32_t maxDoc() = 0;
90 virtual TopDocsPtr search(const WeightPtr& weight, const FilterPtr& filter, int32_t n) = 0;
91 virtual DocumentPtr doc(int32_t n) = 0;
92 virtual DocumentPtr doc(int32_t n, const FieldSelectorPtr& fieldSelector) = 0;
93 virtual QueryPtr rewrite(const QueryPtr& query) = 0;
94 virtual ExplanationPtr explain(const WeightPtr& weight, int32_t doc) = 0;
95 virtual TopFieldDocsPtr search(const WeightPtr& weight, const FilterPtr& filter, int32_t n, const SortPtr& sort) = 0;
96
97 protected:
100 virtual WeightPtr createWeight(const QueryPtr& query);
101 };
102
103 }
104
105 #endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Searchable.h
Lucene::Collection< int32_t >
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::Searchable
The interface for search implementations.
Definition: Searchable.h:24
Lucene::Searcher
An abstract base class for search implementations. Implements the main search methods.
Definition: Searcher.h:18
Lucene::Searcher::search
virtual void search(const QueryPtr &query, const FilterPtr &filter, const CollectorPtr &results)
Lower-level search API.
Lucene::Searcher::search
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,...
Lucene::Searcher::search
virtual void search(const QueryPtr &query, const CollectorPtr &results)
Lower-level search API.
Lucene::Searcher::search
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....
Lucene::Searcher::~Searcher
virtual ~Searcher()
Lucene::Searcher::search
virtual TopFieldDocsPtr search(const QueryPtr &query, const FilterPtr &filter, int32_t n, const SortPtr &sort)
Search implementation with arbitrary sorting. Finds the top n hits for query, applying filter if non-...
Lucene::Searcher::doc
virtual DocumentPtr doc(int32_t n)=0
Returns the stored fields of document i.
Lucene::Searcher::setSimilarity
virtual void setSimilarity(const SimilarityPtr &similarity)
Set the Similarity implementation used by this Searcher.
Lucene::Searcher::close
virtual void close()=0
Frees resources associated with this Searcher. Be careful not to call this method while you are still...
Lucene::Searcher::docFreqs
virtual Collection< int32_t > docFreqs(Collection< TermPtr > terms)
For each term in the terms array, calculates the number of documents containing term....
Lucene::Searcher::createWeight
virtual WeightPtr createWeight(const QueryPtr &query)
Creates a weight for query.
Lucene::Searcher::doc
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...
Lucene::Searcher::maxDoc
virtual int32_t maxDoc()=0
Returns one greater than the largest possible document number.
Lucene::Searcher::search
virtual TopDocsPtr search(const QueryPtr &query, int32_t n)
Finds the top n hits for query.
Lucene::Searcher::similarity
SimilarityPtr similarity
The Similarity implementation used by this searcher.
Definition: Searcher.h:23
Lucene::Searcher::Searcher
Searcher()
Lucene::Searcher::search
virtual TopDocsPtr search(const QueryPtr &query, const FilterPtr &filter, int32_t n)
Finds the top n hits for query, applying filter if non-null.
Lucene::Searcher::docFreq
virtual int32_t docFreq(const TermPtr &term)=0
Returns the number of documents containing term.
Lucene::Searcher::getSimilarity
virtual SimilarityPtr getSimilarity()
Return the Similarity implementation used by this Searcher.
Lucene::Searcher::rewrite
virtual QueryPtr rewrite(const QueryPtr &query)=0
Called to re-write queries into primitive queries.
Lucene::Searcher::search
virtual void search(const WeightPtr &weight, const FilterPtr &filter, const CollectorPtr &results)=0
Lower-level search API.
Lucene::Searcher::explain
virtual ExplanationPtr explain(const WeightPtr &weight, int32_t doc)=0
Low-level implementation method. Returns an Explanation that describes how doc scored against weight.
Lucene::Searcher::explain
virtual ExplanationPtr explain(const QueryPtr &query, int32_t doc)
Returns an Explanation that describes how doc scored against query.
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::TopDocsPtr
boost::shared_ptr< TopDocs > TopDocsPtr
Definition: LuceneTypes.h:471
Lucene::QueryPtr
boost::shared_ptr< Query > QueryPtr
Definition: LuceneTypes.h:420
Lucene::SimilarityPtr
boost::shared_ptr< Similarity > SimilarityPtr
Definition: LuceneTypes.h:435
Lucene::FieldSelectorPtr
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition: LuceneTypes.h:77
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
Lucene::CollectorPtr
boost::shared_ptr< Collector > CollectorPtr
Definition: LuceneTypes.h:295
Lucene::ExplanationPtr
boost::shared_ptr< Explanation > ExplanationPtr
Definition: LuceneTypes.h:333
Lucene::SortPtr
boost::shared_ptr< Sort > SortPtr
Definition: LuceneTypes.h:442
Lucene::TopFieldDocsPtr
boost::shared_ptr< TopFieldDocs > TopFieldDocsPtr
Definition: LuceneTypes.h:474
Lucene::DocumentPtr
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74
Lucene::FilterPtr
boost::shared_ptr< Filter > FilterPtr
Definition: LuceneTypes.h:358
Lucene::WeightPtr
boost::shared_ptr< Weight > WeightPtr
Definition: LuceneTypes.h:480

clucene.sourceforge.net