3 // BinOrderedBinnedRetrieval
5 // 5 January 2007 -- tds
7 // BSD License (http://galagosearch.org/license)
10 #ifndef GALAGO_BINORDEREDBINNEDRETRIEVAL_HPP
11 #define GALAGO_BINORDEREDBINNEDRETRIEVAL_HPP
13 #include "BinnedIndex.hpp"
15 #include "indri/ScoredExtentResult.hpp"
16 #include "BinOrderedBinnedIterator.hpp"
18 #include "Accumulators.hpp"
20 #include "Retrieval.hpp"
26 class ScoredIterator
{
29 bool operator () ( const ScoredIterator
* one
, const ScoredIterator
* two
) const {
30 return one
->maxScore
< two
->maxScore
;
34 BinOrderedBinnedIterator
* iterator
;
39 ScoredIterator( BinOrderedBinnedIterator
* _iterator
) {
50 bool operator< ( const ScoredIterator
& other
) {
51 return maxScore
< other
.maxScore
;
55 class BinOrderedBinnedRetrieval
: public Retrieval
{
57 typedef std::priority_queue
<ScoredIterator
*,
58 std::vector
<ScoredIterator
*>,
59 ScoredIterator::order
> siter_queue
;
62 indri::api::Parameters _parameters
;
64 void _assignMaxScore( std::vector
<ScoredIterator
*>& iterators
);
65 void _assignMaxScore( ScoredIterator
* iterator
);
67 void _calculateQueryWeights( const BinnedIndex
& index
, std::vector
<ScoredIterator
*>& iterators
, int binCount
);
68 void _loadQueue( siter_queue
& queue
, std::vector
<ScoredIterator
*>& iterators
, Accumulators
& accumulators
);
69 void _processExcessTerms( std::vector
<ScoredIterator
*>& iterators
, Accumulators
& accumulators
);
70 void _fetchIterators( std::vector
<ScoredIterator
*>& iterators
, const std::vector
<QueryTerm
>& queryTerms
);
73 void openRead( const std::string
& indexPath
);
75 std::string
getDocument( int document
);
77 std::vector
<indri::api::ScoredExtentResult
> runQuery( const std::vector
<QueryTerm
>& query
, int requested
, int threshold
);
80 #endif // GALAGO_BINORDEREDBINNEDRETRIEVAL_HPP