Exemplo n.º 1
0
bool DatabaseAdapter_ForwardIndex::exists( const DatabaseClientInterface* database_, const Index& typeno_)
{
	DatabaseKey dbkey( DatabaseKey::ForwardIndexPrefix, typeno_);
	Reference<DatabaseCursorInterface> cursor( database_->createCursor( DatabaseOptions().useCache()));
	if (!cursor.get()) return false;
	DatabaseCursorInterface::Slice key = cursor->seekFirst( dbkey.ptr(), dbkey.size());
	return key.defined();
}
Exemplo n.º 2
0
bool DatabaseAdapter_StringIndex::Cursor::getData( const DatabaseCursorInterface::Slice& dbkey, std::string& key, Index& value)
{
	if (!dbkey.defined()) return false;
	key = std::string( dbkey.ptr()+1, dbkey.size()-1);
	DatabaseCursorInterface::Slice blkslice = m_cursor->value();
	char const* vi = blkslice.ptr();
	char const* ve = vi + blkslice.size();
	value = unpackIndex( vi, ve);
	return true;
}
Exemplo n.º 3
0
bool DatabaseAdapter_DocMetaData::getBlock( const DatabaseCursorInterface::Slice& key, MetaDataBlock& blk)
{
	if (!key.defined()) return false;
	char const* ki = key.ptr()+1;
	char const* ke = ki + key.size()-1;
	Index blockno = unpackIndex( ki, ke);
	DatabaseCursorInterface::Slice blkslice = m_cursor->value();
	blk.init( m_descr, blockno, blkslice.ptr(), blkslice.size());
	return true;
}
Exemplo n.º 4
0
bool DatabaseAdapter_DataBlock::Cursor::getBlock( const DatabaseCursorInterface::Slice& key, DataBlock& blk)
{
	if (!key.defined()) return false;
	char const* ki = key.ptr()+m_domainKeySize;
	char const* ke = ki + key.size()-m_domainKeySize;
	Index elemno = unpackIndex( ki, ke);
	DatabaseCursorInterface::Slice blkslice = m_cursor->value();
	blk.init( elemno, blkslice.ptr(), blkslice.size());
	return true;
}
Exemplo n.º 5
0
bool DatabaseAdapter_DocFrequency::Cursor::getData( const DatabaseCursorInterface::Slice& key, Index& typeno, Index& termno, Index& df)
{
	if (!key.defined()) return false;
	char const* ki = key.ptr()+1;
	char const* ke = ki + key.size()-1;
	typeno = unpackIndex( ki, ke);
	termno = unpackIndex( ki, ke);
	DatabaseCursorInterface::Slice blkslice = m_cursor->value();
	char const* vi = blkslice.ptr();
	char const* ve = vi + blkslice.size();
	df = unpackIndex( vi, ve);
	return true;
}