open-source-search-engine/Placedb.h

59 lines
1.1 KiB
C
Raw Normal View History

2013-08-03 00:12:24 +04:00
// Copyright Matt Wells, Aug 2009
#ifndef _PLACEDB_H_
#define _PLACEDB_H_
#include "Rdb.h"
#include "Msg0.h"
class Placedb {
public:
bool init ( ) ;
2014-11-11 01:45:11 +03:00
bool init2 ( int32_t treeMem ) ;
2013-08-03 00:12:24 +04:00
// set up our private rdb
Rdb *getRdb ( ) { return &m_rdb; };
bool addColl ( char *coll, bool doVerify = false );
bool verify ( char *coll ) ;
void reset();
//
// see Address::makePlacedbKey() to see how placedbKey is formed
//
// hash of street, adm1, city and street number
2014-10-30 22:36:39 +03:00
int64_t getBigHash ( key128_t *placedbKey ) {
2013-08-03 00:12:24 +04:00
return placedbKey->n1; };
2014-11-11 01:45:11 +03:00
int32_t getStreetNumHash ( key128_t *placedbKey ) {
2013-08-03 00:12:24 +04:00
return placedbKey->n0 >> 39; };
// docid is top 38 bits
2014-10-30 22:36:39 +03:00
int64_t getDocId ( key128_t *placedbKey ) {
2013-08-03 00:12:24 +04:00
return (placedbKey->n0 >> 1) & DOCID_MASK; };
// the hash of the place name with the street indicator(s)
2014-11-11 01:45:11 +03:00
//int32_t getSmallHash ( key128_t *placedbKey ) {
2013-08-03 00:12:24 +04:00
// return (placedbKey->n0>>1)&0x1ffffff;};
// this rdb holds urls waiting to be spidered or being spidered
Rdb m_rdb;
DiskPageCache *getDiskPageCache() { return &m_pc; };
DiskPageCache m_pc;
};
extern class Placedb g_placedb;
extern class Placedb g_placedb2;
#endif