#include <config.h>
#include "safeerrno.h"
#include <fstream>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "utils.h"
#include "flint_table.h"
#include "flint_cursor.h"
#include "flint_utils.h"
#include <xapian.h>
#include "gnu_getopt.h"
Include dependency graph for xapian-compact.cc:
Go to the source code of this file.
Classes | |
class | PostlistCursor |
class | PostlistCursorGt |
struct | MergeCursor |
struct | CursorGt |
class | PrefixCompressedStringItor |
class | PrefixCompressedStringWriter |
struct | PrefixCompressedStringItorGt |
class | ByteLengthPrefixedStringItor |
struct | ByteLengthPrefixedStringItorGt |
Defines | |
#define | PROG_NAME "xapian-compact" |
#define | PROG_DESC "Compact a flint database, or merge and compact several" |
#define | OPT_HELP 1 |
#define | OPT_VERSION 2 |
#define | OPT_NO_RENUMBER 3 |
#define | MAGIC_XOR_VALUE 96 |
Functions | |
static void | show_usage () |
static bool | is_metainfo_key (const string &key) |
static bool | is_user_metadata_key (const string &key) |
static void | merge_postlists (FlintTable *out, vector< Xapian::docid >::const_iterator offset, vector< string >::const_iterator b, vector< string >::const_iterator e, Xapian::docid tot_off) |
static void | merge_spellings (FlintTable *out, vector< string >::const_iterator b, vector< string >::const_iterator e) |
static void | merge_synonyms (FlintTable *out, vector< string >::const_iterator b, vector< string >::const_iterator e) |
static void | multimerge_postlists (FlintTable *out, const char *tmpdir, Xapian::docid tot_off, vector< string > tmp, vector< Xapian::docid > off) |
static void | merge_docid_keyed (FlintTable *out, const vector< string > &inputs, const vector< Xapian::docid > &offset, bool lazy) |
int | main (int argc, char **argv) |
#define PROG_NAME "xapian-compact" |
Definition at line 44 of file xapian-compact.cc.
#define PROG_DESC "Compact a flint database, or merge and compact several" |
Definition at line 45 of file xapian-compact.cc.
#define OPT_HELP 1 |
Definition at line 47 of file xapian-compact.cc.
#define OPT_VERSION 2 |
Definition at line 48 of file xapian-compact.cc.
#define OPT_NO_RENUMBER 3 |
#define MAGIC_XOR_VALUE 96 |
Definition at line 296 of file xapian-compact.cc.
static void show_usage | ( | ) | [static] |
static bool is_metainfo_key | ( | const string & | key | ) | [inline, static] |
Definition at line 71 of file xapian-compact.cc.
static bool is_user_metadata_key | ( | const string & | key | ) | [inline, static] |
Definition at line 77 of file xapian-compact.cc.
static void merge_postlists | ( | FlintTable * | out, | |
vector< Xapian::docid >::const_iterator | offset, | |||
vector< string >::const_iterator | b, | |||
vector< string >::const_iterator | e, | |||
Xapian::docid | tot_off | |||
) | [static] |
Definition at line 155 of file xapian-compact.cc.
References FlintTable::add(), Assert, PostlistCursor::cf, PostlistCursor::firstdid, is_metainfo_key(), is_user_metadata_key(), PostlistCursor::key, PostlistCursor::next(), pack_uint(), pack_uint_last(), pack_uint_preserving_sort(), PostlistCursor::tag, PostlistCursor::tf, unpack_uint(), and unpack_uint_last().
Referenced by main(), and multimerge_postlists().
static void merge_spellings | ( | FlintTable * | out, | |
vector< string >::const_iterator | b, | |||
vector< string >::const_iterator | e | |||
) | [static] |
Definition at line 391 of file xapian-compact.cc.
References FlintTable::add(), PrefixCompressedStringWriter::append(), DONT_COMPRESS, pack_uint_last(), and unpack_uint_last().
Referenced by main().
static void merge_synonyms | ( | FlintTable * | out, | |
vector< string >::const_iterator | b, | |||
vector< string >::const_iterator | e | |||
) | [static] |
Definition at line 554 of file xapian-compact.cc.
References FlintTable::add(), DONT_COMPRESS, and MAGIC_XOR_VALUE.
Referenced by main().
static void multimerge_postlists | ( | FlintTable * | out, | |
const char * | tmpdir, | |||
Xapian::docid | tot_off, | |||
vector< string > | tmp, | |||
vector< Xapian::docid > | off | |||
) | [static] |
Definition at line 640 of file xapian-compact.cc.
References FlintTable::commit(), FlintTable::create_and_open(), merge_postlists(), and unlink().
Referenced by main().
static void merge_docid_keyed | ( | FlintTable * | out, | |
const vector< string > & | inputs, | |||
const vector< Xapian::docid > & | offset, | |||
bool | lazy | |||
) | [static] |
Definition at line 691 of file xapian-compact.cc.
References FlintTable::add(), FlintCursor::current_key, FlintCursor::current_tag, DONT_COMPRESS, FlintCursor::find_entry(), FlintTable::get_entry_count(), FlintCursor::next(), FlintTable::open(), pack_uint_preserving_sort(), FlintCursor::read_tag(), and unpack_uint_preserving_sort().
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 732 of file xapian-compact.cc.
References DONT_COMPRESS, Xapian::Database::get_doccount(), Xapian::Database::get_lastdocid(), gnu_getopt_long(), if(), long_opts, merge_docid_keyed(), merge_postlists(), merge_spellings(), merge_synonyms(), mkdir(), multimerge_postlists(), no_argument, OPT_HELP, OPT_NO_RENUMBER, OPT_VERSION, optarg, optind, opts, PACKAGE_STRING, Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), PROG_DESC, PROG_NAME, required_argument, S_ISDIR, show_usage(), srcdir, stat(), and SYNONYM.