diff --git a/secondary/pgm.h b/secondary/pgm.h index 8e17cea3..ef3730dc 100644 --- a/secondary/pgm.h +++ b/secondary/pgm.h @@ -41,17 +41,16 @@ namespace SI }; template - struct PGM_T : public pgm::PGMIndex, public PGM_i + class PGM_T : public pgm::PGMIndex, public PGM_i { - PGM_T () - { - } + using BASE = pgm::PGMIndex; + using BASE::BASE; + public: template PGM_T ( RandomIt tBegin, RandomIt tEnd ) - : pgm::PGMIndex ( tBegin, tEnd ) - { - } + : BASE ( tBegin, tEnd ) + {} size_t Save ( std::vector & dData ) const final { @@ -104,21 +103,9 @@ namespace SI } ApproxPos_t Search ( uint64_t uVal ) const final; - - void WriteTypedKey ( util::MemWriter_c & tWr, VALUE tVal ) const - { - tWr.Pack_uint64 ( (uint64_t)tVal ); - } - - void LoadTypedKey ( util::FileReader_c & tRd, VALUE & tVal ) const - { - tVal = tRd.Unpack_uint64(); - } - - bool IsEmpty () const final - { - return ( this->n==0 ); - } + void WriteTypedKey ( util::MemWriter_c & tWr, VALUE tVal ) const { tWr.Pack_uint64 ( (uint64_t)tVal ); } + void LoadTypedKey ( util::FileReader_c & tRd, VALUE & tVal ) const { tVal = tRd.Unpack_uint64(); } + bool IsEmpty () const final { return this->n==0; } }; template<> diff --git a/secondary/secondary.cpp b/secondary/secondary.cpp index 7c3aeb69..8e8a0851 100644 --- a/secondary/secondary.cpp +++ b/secondary/secondary.cpp @@ -539,7 +539,10 @@ uint32_t SecondaryIndex_c::GetNumIterators ( const common::Filter_t & tFilter ) switch ( tFixedFilter.m_eType ) { case FilterType_e::VALUES: - return GetValsRows ( nullptr, tFixedFilter, nullptr, 0, 0, INT_MAX ); + { + uint32_t uNumIterators = GetValsRows ( nullptr, tFixedFilter, nullptr, 0, 0, INT_MAX ); + return std::min ( (uint32_t)tFilter.m_dValues.size(), uNumIterators ); + } case FilterType_e::RANGE: case FilterType_e::FLOATRANGE: