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

Loading...
Searching...
No Matches
TopDocsCollector.h
Go to the documentation of this file.
1
2// 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 TOPDOCSCOLLECTOR_H
8#define TOPDOCSCOLLECTOR_H
9
10#include "Collector.h"
11#include "PriorityQueue.h"
12
13 namespace Lucene {
14
21 class LPPAPI TopDocsCollector : public Collector {
22 public:
23 TopDocsCollector(const HitQueueBasePtr& pq);
24 virtual ~TopDocsCollector();
25
26 LUCENE_CLASS(TopDocsCollector);
27
28 protected:
32 HitQueueBasePtr pq;
33
35 int32_t totalHits;
36
37 public:
39 virtual int32_t getTotalHits();
40
42 virtual TopDocsPtr topDocs();
43
53 virtual TopDocsPtr topDocs(int32_t start);
54
65 virtual TopDocsPtr topDocs(int32_t start, int32_t howMany);
66
67 protected:
69 static TopDocsPtr EMPTY_TOPDOCS();
70
73 virtual void populateResults(Collection<ScoreDocPtr> results, int32_t howMany);
74
78 virtual TopDocsPtr newTopDocs(Collection<ScoreDocPtr> results, int32_t start);
79};
80
81}
82
83#endif
Collector.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
PriorityQueue.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::Collector
Collectors are primarily meant to be used to gather raw results from a search, and implement sorting ...
Definition Collector.h:100
Lucene::TopDocsCollector
A base class for all collectors that return a TopDocs output. This collector allows easy extension by...
Definition TopDocsCollector.h:21
Lucene::TopDocsCollector::pq
HitQueueBasePtr pq
The priority queue which holds the top documents. Note that different implementations of PriorityQueu...
Definition TopDocsCollector.h:32
Lucene::TopDocsCollector::EMPTY_TOPDOCS
static TopDocsPtr EMPTY_TOPDOCS()
This is used in case topDocs() is called with illegal parameters, or there simply aren't (enough) res...
Lucene::TopDocsCollector::totalHits
int32_t totalHits
The total number of documents that the collector encountered.
Definition TopDocsCollector.h:35
Lucene::TopDocsCollector::TopDocsCollector
TopDocsCollector(const HitQueueBasePtr &pq)
Lucene::TopDocsCollector::~TopDocsCollector
virtual ~TopDocsCollector()
Lucene::TopDocsCollector::topDocs
virtual TopDocsPtr topDocs(int32_t start, int32_t howMany)
Returns the documents in the rage [start .. start + howMany) that were collected by this collector....
Lucene::TopDocsCollector::populateResults
virtual void populateResults(Collection< ScoreDocPtr > results, int32_t howMany)
Populates the results array with the ScoreDoc instances. This can be overridden in case a different S...
Lucene::TopDocsCollector::getTotalHits
virtual int32_t getTotalHits()
The total number of documents that matched this query.
Lucene::TopDocsCollector::newTopDocs
virtual TopDocsPtr newTopDocs(Collection< ScoreDocPtr > results, int32_t start)
Returns a TopDocs instance containing the given results. If results is null it means there are no res...
Lucene::TopDocsCollector::topDocs
virtual TopDocsPtr topDocs(int32_t start)
Returns the documents in the range [start .. pq.size()) that were collected by this collector....
Lucene::TopDocsCollector::topDocs
virtual TopDocsPtr topDocs()
Returns the top docs that were collected by this collector.
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::TopDocsPtr
boost::shared_ptr< TopDocs > TopDocsPtr
Definition LuceneTypes.h:471
Lucene::HitQueueBasePtr
boost::shared_ptr< HitQueueBase > HitQueueBasePtr
Definition LuceneTypes.h:371

clucene.sourceforge.net