Tanl Linguistic Pipeline |
Classes | |
class | Cursor |
A Cursor on a Table<T, IndexerClass>. More... | |
Public Types | |
enum | DbType { Btree, Hash, FixLen } |
typedef T | ItemType |
typedef Table< T, IndexerClass > | TableType |
Public Member Functions | |
char const * | tableName () |
Table (char const *pathname, bool readonly=false, MetaClass *meta=CLASS_OF(T), Size cacheSize=0, DbType DBtype=Btree, Size uniqueElements=0) | |
Create table. | |
Table (Table const &table) | |
Clone table, to be used concurrently by another thread. | |
Table (Table const &table, bool readonly) | |
Open duplicate table on same DB. | |
Table () | |
Used for cloning Collection. | |
void | noFulltextIndexing () |
Avoid performing fulltext indexing. | |
void | commit () |
Save changes. | |
bool | insert (ItemType *obj) |
Insert an object in the table. | |
bool | remove (ItemType *obj) |
Remove the stored object with the same primary key as. | |
bool | insertDynamic (AnyObject *obj) |
void | stopWords (StopWords *stopWords) |
Set the stop list for all fulltext fields. | |
void | stopWords (char const *fieldname, StopWords *stopWords) |
Set the stop list for a given fulltext field. | |
T | operator[] (int i) const |
Implement Indexable interface. | |
DocID | getDocID (const char *field, const char *value) |
Get the DocID of a document. | |
DocID | getDocID (ItemType *obj) |
Get the DocID of a document. | |
void | Metadata (byte *obj, MetaClass *metadataClass) |
Get metadata for table. | |
void | Metadata (MetaClass *metadataClass, byte *obj) |
Set metadata for table. | |
Count | size () |
Return the number of objects in the table. | |
DocID | merge (TableType *table2, Remap &remap) |
Merge this table with another one having the same structure, i.e. | |
template<class DeleteTest > | |
DocID | merge (TableType *table2, DeleteTest delendum, Remap &remap) |
Merge this table with another one having the same structure, i.e. | |
std::vector< TCBDB * > & | Keys () |
TCBDB * | Primary () const |
DBT & | Key () |
Field * | PrimaryField () const |
Size | MaxRowSize () const |
DocID | LastID () |
void | LastID (DocID lastID) |
Sets key of last item in table. | |
Public Attributes | |
MetaClass * | metaClass |
IndexerClass * | fulltextIndexer |
indexer for fulltext fields | |
std::vector< MappedSubField > | mappedFields |
for value type fields | |
std::vector< SubField > | subFields |
for fields with Metaclasses | |
Protected Member Functions | |
void | open (char const *basename, bool readonly, DbType dbType, Size uniqueElements=0, int cacheLeaves=0, int cacheNodes=0) |
byte * | mappedField (Field *fd, DocID id) |
access the mapped field | |
void | close () |
void | LastID (DocID *lastID) |
Fetches key of last item in table. | |
void | fetch (byte *obj, byte *row) |
void | removeSecondary (ItemType const &obj) |
Remove secondary keys associated to object. | |
void | insertRow (ItemType *obj) |
Auxiliary method for insertion. | |
Protected Attributes | |
char const * | table_name |
TCFDB * | metadata |
for storing table metadata (i.e. schema) | |
TCBDB * | primary |
primary key index | |
TCHDB * | unique |
unique key index | |
std::vector< TCBDB * > | keys |
secondary keys | |
DBT | key |
used by insert() | |
DBT | row |
allocated at first insert() | |
ulonglong | keyID |
optimize primary key | |
DocID | lastID |
remember last assigned ID | |
bool | isNew |
whether using existing DB | |
Count | nFulltext |
number of fulltext columns | |
Count | nRows |
not supported by BDB | |
Count | nUnique |
no. of unique fields | |
Field * | autoincrementField |
Field * | externalField |
Field * | primaryField |
Field * | uniqueField |
Size | maxRowSize |
max size for row | |
bool | master |
whether this is the master open | |
DbType | dbType |
Lock | mutex |
Friends | |
class | DynamicTable |
class | Cursor |
enum IXE::Table::DbType |
IXE::Table< T, IndexerClass >::Table | ( | char const * | pathname, | |
bool | readonly = false , |
|||
MetaClass * | meta = CLASS_OF(T) , |
|||
Size | cacheSize = 0 , |
|||
DbType | DBtype = Btree , |
|||
Size | uniqueElements = 0 | |||
) |
Create table.
pathname | base name of files used to store table data | |
cacheNodes | number of non-leaf nodes to be cached | |
cacheLeaves | number of leaf nodes to be cached | |
DBtype | type of database, either Btree (default), Hash or RecNo | |
uniqueElements | estimate of the number of unique elements the table will contain |
DocID IXE::Table< T, IndexerClass >::getDocID | ( | ItemType * | obj | ) |
Get the DocID of a document.
obj | obj with a unique key field |
DocID IXE::Table< T, IndexerClass >::getDocID | ( | const char * | field, | |
const char * | value | |||
) |
Get the DocID of a document.
field | name of unique key field | |
value | unique key value |
Referenced by IXE::Table< ItemType, IndexerClass >::merge().
bool IXE::Table< T, IndexerClass >::insert | ( | ItemType * | obj | ) |
Insert an object in the table.
There is no remove() method at the moment since fulltext indexes cannot be updated dynamically. Use merge() to recreate an index without the objects to be removed.
The object may be modified by a reader.
Reimplemented in IXE::DynamicTable.
void IXE::Table< T, IndexerClass >::LastID | ( | DocID | lastID | ) | [inline] |
Sets key of last item in table.
Used for Hash tables, since last ID cannot be desumed from last item.
DocID IXE::Table< T, IndexerClass >::LastID | ( | ) | [inline] |
Referenced by IXE::Table< ItemType, IndexerClass >::merge().
byte* IXE::Table< T, IndexerClass >::mappedField | ( | Field * | fd, | |
DocID | id | |||
) | [inline, protected] |
access the mapped field
fd | of document | |
id. |
Referenced by IXE::Table< T, IndexerClass >::Cursor::get().
DocID IXE::Table< T, IndexerClass >::merge | ( | TableType * | table2, | |
DeleteTest | delendum, | |||
Remap & | remap | |||
) | [inline] |
Merge this table with another one having the same structure, i.e.
metaclass, removing some objects. Fulltext indices should be merged separately.
DocIDs of second table are renumbered.
delendum | is a functional object that returns true for objects to be deleted. Default is always false, so no object is deleted. | |
remap | will contain for each deleted document the count of preceding deleted documents (used to renumber documents by subtracting this value). |
DocID IXE::Table< T, IndexerClass >::merge | ( | TableType * | table2, | |
Remap & | remap | |||
) | [inline] |
Merge this table with another one having the same structure, i.e.
metaclass. Fulltext indices should be merged separately.
DocIDs of second table are renumbered:
remap | for duplicate documents it will be filled with map from DocID in table2 to DocID in this table. |
Referenced by IXE::Table< ItemType, IndexerClass >::merge().
void IXE::Table< T, IndexerClass >::Metadata | ( | MetaClass * | metadataClass, | |
byte * | obj | |||
) |
Set metadata for table.
A single object can be stored as metadata. Such object can be of any class C which has a metaclass.
metadataClass | is the metaclass for the object to be stored | |
obj | is an instance of a class whose metaclass is metadataClass |
void IXE::Table< T, IndexerClass >::Metadata | ( | byte * | obj, | |
MetaClass * | metadataClass | |||
) |
Get metadata for table.
obj | is an object of metaclass is | |
metadataClass,where | to store the metadata. | |
metadataClass | the metaclass for the object to be retrieved. |
void IXE::Table< T, IndexerClass >::noFulltextIndexing | ( | ) | [inline] |
Avoid performing fulltext indexing.
This is useful for merging, where the fulltext index is created by merging.
void IXE::Table< T, IndexerClass >::open | ( | char const * | basename, | |
bool | readonly, | |||
DbType | dbType, | |||
Size | uniqueElements = 0 , |
|||
int | cacheLeaves = 0 , |
|||
int | cacheNodes = 0 | |||
) | [protected] |
basename | is the table file pathname without extension. | |
readonly | determines opening mode. | |
DBtype | can be either Btree or Hash. | |
uniqueElements | is an estimate of the number of elements, used to tune the cache size. | |
cacheLeaves | and | |
cacheNodes | are parameters to set @ the cache size. |
Referenced by IXE::Table< ItemType, IndexerClass >::Table().
T IXE::Table< T, IndexerClass >::operator[] | ( | int | i | ) | const [inline, virtual] |
bool IXE::Table< T, IndexerClass >::remove | ( | ItemType * | obj | ) |
Remove the stored object with the same primary key as.
obj. | This does not update the fulltext index, but calls Indexer::replace(), to add it to its list of documents to be updated. | |
obj | the replacing object |
void IXE::Table< T, IndexerClass >::removeSecondary | ( | ItemType const & | obj | ) | [protected] |
Remove secondary keys associated to object.
obj | the object to be removed |
Count IXE::Table< T, IndexerClass >::size | ( | ) | [inline] |
Return the number of objects in the table.