1
/*------------------------------------------------------------------------------
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
4
* Distributable under the terms of either the Apache License (Version 2.0) or
5
* the GNU Lesser General Public License, as specified in the COPYING file.
6
------------------------------------------------------------------------------*/
7
#ifndef _lucene_search_multisearcher
8
#define _lucene_search_multisearcher
10
#if defined(_LUCENE_PRAGMA_ONCE)
14
#include "SearchHeader.h"
15
#include "CLucene/document/Document.h"
16
#include "CLucene/index/Term.h"
20
class MultiHitCollector: public HitCollector{
22
HitCollector* results;
25
MultiHitCollector(HitCollector* _results, int32_t _start);
26
void collect(const int32_t doc, const float_t score) ;
30
/** Implements search over a set of <code>Searchables</code>.
32
* <p>Applications usually need only call the inherited {@link #search(Query)}
33
* or {@link #search(Query,Filter)} methods.
35
class MultiSearcher: public Searcher {
37
Searchable** searchables;
38
int32_t searchablesLen;
42
int32_t* getStarts() {
47
/** Creates a searcher which searches <i>Searchables</i>. */
48
MultiSearcher(Searchable** searchables);
52
/** Frees resources associated with this <code>Searcher</code>. */
55
int32_t docFreq(const CL_NS(index)::Term* term) const ;
57
/** For use by {@link HitCollector} implementations. */
58
bool doc(int32_t n, CL_NS(document)::Document* document);
60
/** For use by {@link HitCollector} implementations to identify the
61
* index of the sub-searcher that a particular hit came from. */
62
int32_t searcherIndex(int32_t n) const;
64
int32_t subSearcher(int32_t n) const;
66
int32_t subDoc(int32_t n) const;
68
int32_t maxDoc() const;
70
TopDocs* _search(Query* query, Filter* filter, const int32_t nDocs) ;
72
TopFieldDocs* _search (Query* query, Filter* filter, const int32_t n, const Sort* sort);
74
/** Lower-level search API.
76
* <p>{@link HitCollector#collect(int32_t,float_t)} is called for every non-zero
79
* <p>Applications should only use this if they need <i>all</i> of the
80
* matching documents. The high-level search API ({@link
81
* Searcher#search(Query)}) is usually more efficient, as it skips
82
* non-high-scoring hits.
84
* @param query to match documents
85
* @param filter if non-null, a bitset used to eliminate some documents
86
* @param results to receive hits
88
void _search(Query* query, Filter* filter, HitCollector* results);
90
Query* rewrite(Query* original);
91
void explain(Query* query, int32_t doc, Explanation* ret);