ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Private Attributes | List of all members
meta::index::metadata_writer Class Reference

Writes document metadata into the packed format for the index. More...

#include <metadata_writer.h>

Public Member Functions

 metadata_writer (const std::string &prefix, uint64_t num_docs, corpus::metadata::schema_type schema)
 Constructs the writer. More...
 
void write (doc_id d_id, uint64_t length, uint64_t num_unique, const std::vector< corpus::metadata::field > &mdata)
 Writes a document's metadata to the database and index. More...
 

Private Attributes

std::mutex lock_
 a lock for thread safety
 
util::disk_vector< uint64_t > seek_pos_
 the index into the database file
 
uint64_t byte_pos_
 the current byte position in the database
 
std::ofstream db_file_
 the output stream for the database file
 
corpus::metadata::schema_type schema_
 the schema of the metadata we are writing
 

Detailed Description

Writes document metadata into the packed format for the index.

Constructor & Destructor Documentation

§ metadata_writer()

meta::index::metadata_writer::metadata_writer ( const std::string &  prefix,
uint64_t  num_docs,
corpus::metadata::schema_type  schema 
)

Constructs the writer.

Parameters
prefixThe directory to place the metadata database and index
num_docsThe number of documents we have metadata for
schemaThe schema for the metadata we will store

Member Function Documentation

§ write()

void meta::index::metadata_writer::write ( doc_id  d_id,
uint64_t  length,
uint64_t  num_unique,
const std::vector< corpus::metadata::field > &  mdata 
)

Writes a document's metadata to the database and index.

Parameters
d_idThe document id
lengthThe length of the document
num_uniqueThe number of unique terms in the document
mdataAny additional metadata to be written

The documentation for this class was generated from the following files: