open-source-search-engine/IndexList.cpp

49 lines
1.6 KiB
C++
Raw Normal View History

2013-08-03 00:12:24 +04:00
#include "gb-include.h"
#include "IndexList.h"
#include <math.h> // log() math functions
#include "Datedb.h" // g_datedb
// . clear the low bits on the keys so terms are DELETED
// . used by Msg14 to delete a document completely from the index
void IndexList::clearDelBits ( ) {
// get the list (may be the whole list, m_list)
//key_t *keys = (key_t *) RdbList::getList();
// . how many keys do we have?
// . all keys should be 12 bytes since we don't repeat the termId
2014-11-11 01:45:11 +03:00
//int32_t numKeys = RdbList::getListSize() / sizeof(key_t);
2013-08-03 00:12:24 +04:00
// loop thru each key and clear it's del bit
2014-11-11 01:45:11 +03:00
//for ( int32_t i = 0 ; i < numKeys ; i++ )
2013-08-03 00:12:24 +04:00
// keys[i].n0 &= 0xfffffffffffffffeLL;
char *p = m_list;
char *pend = m_list + m_listSize;
2014-11-11 01:45:11 +03:00
int32_t step = m_ks;
2013-08-03 00:12:24 +04:00
for ( ; p < pend ; p += step ) *p &= 0xfe;
}
void IndexList::print() {
if ( m_ks==16 ) logf(LOG_DEBUG,"db: termId date score docId");
else logf(LOG_DEBUG,"db: termId score docId");
2014-11-11 01:45:11 +03:00
int32_t i = 0;
2013-08-03 00:12:24 +04:00
for ( resetListPtr() ; ! isExhausted() ; skipCurrentRecord() ) {
// print out date lists here
if ( m_ks == 16 ) {
logf(LOG_DEBUG,
2014-11-11 01:45:11 +03:00
"db: %04"INT32") %020"INT64" "
"%10"UINT32" %03"INT32" %020"INT64"",
2013-08-03 00:12:24 +04:00
i++ ,
getTermId16(m_listPtr),
2014-11-11 01:45:11 +03:00
(int32_t)getCurrentDate(),
(int32_t)getCurrentScore(),
2014-10-30 22:36:39 +03:00
(int64_t)getCurrentDocId() );
2013-08-03 00:12:24 +04:00
continue;
}
logf(LOG_DEBUG,"db: %04"INT32") %020"INT64" "
"%03"INT32" %020"INT64"" ,
2013-08-03 00:12:24 +04:00
i++ ,
2014-10-30 22:36:39 +03:00
(int64_t)getCurrentTermId12() ,
2014-11-11 01:45:11 +03:00
(int32_t)getCurrentScore(),
2014-10-30 22:36:39 +03:00
(int64_t)getCurrentDocId() );
2013-08-03 00:12:24 +04:00
}
}