Xpace
Xpace::Index Class Reference

An index. More...

#include <index.h>

Classes

class  Iter
 index term iterator More...
 
class  Sink
 traverse each term, or each reference, in an interval of terms More...
 
struct  sortStatus
 sort this index; could take a while status callback More...
 
struct  WriteStatus
 write this index; could take a while status callback More...
 

Public Types

enum  { MAX_TERM_SIZE = 8192 }
 

Public Member Functions

 Index (const Configuration &config)
 create an empty index More...
 
 Index (const Configuration &config, File *indexFile, File::Position oRoot, uint64 refCount=0)
 read an index More...
 
bool operator! () const
 
bool hasCounts () const
 
String getName () const
 
String getConfig () const
 
bool makeSorted (sortStatus *st=0)
 
File::Position write (File *file, WriteStatus *st=0)
 
uint64 getTermCount () const
 
Iter begin () const
 
Iter begin (const String &key, bool *found=0) const
 find a key in the index More...
 
Iter begin (int64 key, bool *found=0) const
 
Iter begin (const BytesRef &key, bool *found=0) const
 
Iter beginAdd (const String &key, bool *added)
 search for a key, adding if it's not there More...
 
Iter beginAdd (int64 key, bool *added)
 
Iter beginAdd (const BytesRef &key, bool *added)
 
Iter end () const
 
bool regexOK () const
 
String next (const String &key) const
 
bool forEachTerm (Iter &begin, Iter &end, Sink *sink, const RefListCursor *refList=0) const
 traverse each term in the range [begin, end) More...
 
bool forEachTerm (uint64 start, uint64 count, Sink *sink, const RefListCursor *refList=0) const
 
bool forEachTerm (Sink *sink, const RefListCursor *refList=0) const
 
bool forEachRef (Iter &begin, Iter &end, Sink *act) const
 traverse each ref in each term in the range [begin, end) More...
 
bool forEachRef (uint64 start, uint64 count, Sink *act) const
 
bool forEachRef (Sink *act) const
 

Static Public Member Functions

static File::Position merge (File *file, std::vector< Index > &list)
 merge a list of indexes More...
 

Static Public Attributes

static const char * FIELD_TAG
 Configuration tag for an indexed field. More...
 
static const char * PARSED_TAG
 Configuration tag for a parsed index. More...
 

Detailed Description

An index.

Definition at line 24 of file index.h.

Member Enumeration Documentation

anonymous enum
Enumerator
MAX_TERM_SIZE 

Definition at line 27 of file index.h.

Constructor & Destructor Documentation

Xpace::Index::Index ( const Configuration config)
explicit

create an empty index

Parameters
configuse this configuration
Xpace::Index::Index ( const Configuration config,
File indexFile,
File::Position  oRoot,
uint64  refCount = 0 
)

read an index

Parameters
configuse this configuration
indexFileread from this file
oRootfile position of index root
refCountnumber of refs in the index's universe

Member Function Documentation

bool Xpace::Index::operator! ( ) const
Returns
true iff the index is empty
bool Xpace::Index::hasCounts ( ) const
Returns
true iff the index has term counts
String Xpace::Index::getName ( ) const
Returns
Index's name
String Xpace::Index::getConfig ( ) const
Returns
Index's configuration
bool Xpace::Index::makeSorted ( sortStatus st = 0)
Parameters
ststatus callback
File::Position Xpace::Index::write ( File file,
WriteStatus st = 0 
)
Parameters
filewrite to this file (at current position)
ststatus callback
Returns
file position of index root
static File::Position Xpace::Index::merge ( File file,
std::vector< Index > &  list 
)
static

merge a list of indexes

Parameters
filemerge to this file
listmerge these indexes
Returns
file position of index root
uint64 Xpace::Index::getTermCount ( ) const
Returns
the number of terms in the index
Iter Xpace::Index::begin ( ) const
Returns
Iter corresponding to the first term in the Index
Iter Xpace::Index::begin ( const String key,
bool found = 0 
) const

find a key in the index

Parameters
keyfind this String
foundfillin true if key is found
Returns
Iter corresponding to the key, next Iter if not found
Iter Xpace::Index::begin ( int64  key,
bool found = 0 
) const
Parameters
keyfind this int64
Return values
foundfillin true if key is found
Returns
Iter corresponding to the key, next Iter if not found
Iter Xpace::Index::begin ( const BytesRef key,
bool found = 0 
) const
Parameters
keyfind this Key
Return values
foundfillin true if key is found
Returns
Iter corresponding to the key, next Iter if not found
Iter Xpace::Index::beginAdd ( const String key,
bool added 
)

search for a key, adding if it's not there

Parameters
keyfind/add this String
addedfillin true if key was added
Returns
Iter corresponding to the key
Iter Xpace::Index::beginAdd ( int64  key,
bool added 
)
Parameters
keyfind/add this int64
addedfillin true if key was added
Returns
Iter corresponding to the key
Iter Xpace::Index::beginAdd ( const BytesRef key,
bool added 
)
Parameters
keyfind/add this Key
foundfillin true if key was added
Returns
Iter corresponding to the key
Iter Xpace::Index::end ( ) const
Returns
the iter one past the end
bool Xpace::Index::regexOK ( ) const
Returns
true iff term can match a regular expression (next() must return something meaningful)
String Xpace::Index::next ( const String key) const
Parameters
terman index term
Returns
the next possible term of the same length after this one
bool Xpace::Index::forEachTerm ( Iter begin,
Iter end,
Sink sink,
const RefListCursor refList = 0 
) const

traverse each term in the range [begin, end)

Parameters
beginstart here
endend here
actcall this for each term
refListif != 0, call act only for terms in this refList
Returns
true if completed, false if stopped by callback
bool Xpace::Index::forEachTerm ( uint64  start,
uint64  count,
Sink sink,
const RefListCursor refList = 0 
) const
Parameters
startstart at the start'th term
countfor this many terms
bool Xpace::Index::forEachTerm ( Sink sink,
const RefListCursor refList = 0 
) const
inline

Definition at line 307 of file index.h.

bool Xpace::Index::forEachRef ( Iter begin,
Iter end,
Sink act 
) const

traverse each ref in each term in the range [begin, end)

Parameters
beginstart here
endend here
actcall this for each term, and each ref
Returns
true if completed, false if stopped by callback
bool Xpace::Index::forEachRef ( uint64  start,
uint64  count,
Sink act 
) const
Parameters
startstart at the start'th term
countfor this many terms
Returns
true if completed, false if stopped by callback
bool Xpace::Index::forEachRef ( Sink act) const
inline

Definition at line 333 of file index.h.

References DECLARE_IMPL.

Member Data Documentation

const char* Xpace::Index::FIELD_TAG
static

Configuration tag for an indexed field.

Definition at line 29 of file index.h.

const char* Xpace::Index::PARSED_TAG
static

Configuration tag for a parsed index.

Definition at line 30 of file index.h.


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

current as of Wed Jun 10 2026 12:00:06