---
name: "WordRecord"
section: "3"
platform: "linux"
package: "libmifluz0-dev"
version: "0.24.0-9"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/WordRecord"
---

# WordRecord(3)

inverted index record.

## NAME

WordRecord - inverted index record.

## SYNOPSIS

```
#include <WordRecord.h>
WordContext* context;
WordRecord* record = context->Record();
if(record->DefaultType() == WORD_RECORD_DATA) {
  record->info.data = 120;
} else if(record->DefaultType() == WORD_RECORD_STR) {
  record->info.str = "foobar";
}
delete record;
```

## DESCRIPTION

The record can contain an integer, if the default record type (see CONFIGURATION in *WordKeyInfo* ) is set to *DATA* or a string if set to *STR.* If the type is set to *NONE* the record does not contain any usable information.

Although constructors may be used, the prefered way to create a  WordRecord object is by using the **WordContext::Record** method.

## ASCII FORMAT

If default type is *DATA* it is the decimal representation of an integer. If default type is *NONE* it is the empty string.

## METHODS

- **inline WordRecord(WordContext\* ncontext)**

  Constructor. Build an empty record. The **ncontext** argument must be a pointer to a valid WordContext object.

- **inline void Clear()**

  Reset to empty and set the type to the default specified in the configuration.

- **inline int DefaultType()**

  Return the default type WORD\_RECORD\_{DATA,STR,NONE}

- **inline int Pack(String& packed) const**

  Convert the object to a representation for disk storage written in the **packed** string. Return OK on success, NOTOK otherwise.

- **inline int Unpack(const char\* string, int length)**

  Alias for Unpack(String(string, length))

- **inline int Unpack(const String& packed)**

  Read the object from a representation for disk storage contained in the **packed** argument. Return OK on success, NOTOK otherwise.

- **int Set(const String& bufferin)**

  Set the whole structure from ASCII string description stored in the **bufferin** argument. Return OK on success, NOTOK otherwise.

- **int Get(String& bufferout) const**

  Convert the whole structure to an ASCII string description and return it in the **bufferout** argument. Return OK on success, NOTOK otherwise.

- **String Get() const**

  Convert the whole structure to an ASCII string description and return it.

- **inline WordContext\* GetContext()**

  Return a pointer to the WordContext object used to create this instance.

- **inline const WordContext\* GetContext() const**

  Return a pointer to the WordContext object used to create this instance as a const.

- **int Write(FILE\* f) const**

  Print object in ASCII form on descriptor **f** using the Get method.

## AUTHORS

Loic Dachary loic@gnu.org

The Ht://Dig group http://dev.htdig.org/

## SEE ALSO

[htdb\_dump(1)](/htdb_dump/1.md), [htdb\_stat(1)](/htdb_stat/1.md), [htdb\_load(1)](/htdb_load/1.md), [mifluzdump(1)](/mifluzdump/1.md), [mifluzload(1)](/mifluzload/1.md), [mifluzsearch(1)](/mifluzsearch/1.md), [mifluzdict(1)](/mifluzdict/1.md), [WordContext(3)](/WordContext/3.md), [WordList(3)](/WordList/3.md), [WordDict(3)](/WordDict/3.md), [WordListOne(3)](/WordListOne/3.md), [WordKey(3)](/WordKey/3.md), [WordKeyInfo(3)](/WordKeyInfo/3.md), [WordType(3)](/WordType/3.md), [WordDBInfo(3)](/WordDBInfo/3.md), [WordRecordInfo(3)](/WordRecordInfo/3.md), [WordReference(3)](/WordReference/3.md), [WordCursor(3)](/WordCursor/3.md), [WordCursorOne(3)](/WordCursorOne/3.md), [WordMonitor(3)](/WordMonitor/3.md), [Configuration(3)](/Configuration/3.md), [mifluz(3)](/mifluz/3.md)
