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

# WordReference(3)

inverted index occurrence.

## NAME

WordReference - inverted index occurrence.

## SYNOPSIS

```
#include <WordReference.h>
WordContext* context;
WordReference* word = context->Word("word");
WordReference* word = context->Word();
WordReference* word = context->Word(WordKey("key 1 2"), WordRecord());
WordKey key = word->Key()
WordKey record = word->Record()
word->Clear();
delete word;
```

## DESCRIPTION

A *WordReference* object is an agregate of a *WordKey* object and a *WordRecord* object.

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

## ASCII FORMAT

The ASCII description is a string with fields separated by tabs or white space. It is made of the ASCII description of a *WordKey* object immediately followed by the ASCII description of a *WordRecord* object.  See the corresponding manual pages for more information.

## METHODS

- **WordReference(WordContext\* ncontext) :**

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

- **WordReference(WordContext\* ncontext, const String& key0, const String& record0) :**

  Constructor. Build an object from disk representation of **key** and **record** The **ncontext** argument must be a pointer to a valid WordContext object.

- **WordReference(WordContext\* ncontext, const String& word) :**

  Constructor. Build an object with key word set to **word** and otherwise empty and empty record. The **ncontext** argument must be a pointer to a valid WordContext object.

- **void Clear()**

  Reset to empty key and record

- **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.

- **inline String& GetWord()**

  Return the **word** data member.

- **inline const String& GetWord() const**

  Return the **word** data member as a const.

- **inline void SetWord(const String& nword)**

  Set the **word** data member from the **nword** argument.

- **WordKey& Key()**

  Return the key object.

- **const WordKey& Key() const**

  Return the key object as const.

- **WordRecord& Record()**

  Return the record object.

- **const WordRecord& Record() const**

  Return the record object as const.

- **void Key(const WordKey& arg)**

  Copy **arg** in the key part of the object.

- **int KeyUnpack(const String& packed)**

  Set key structure from disk storage format as found in **packed** string. Return OK if successfull, NOTOK otherwise.

- **String KeyPack() const**

  Convert key object into disk storage format as found in  return the resulting string.

- **int KeyPack(String& packed) const**

  Convert key object into disk storage format as found in  and place the result in **packed** string. Return OK if successfull, NOTOK otherwise.

- **void Record(const WordRecord& arg)**

  Copy **arg** in the record part of the object.

- **int RecordUnpack(const String& packed)**

  Set record structure from disk storage format as found in **packed** string. Return OK if successfull, NOTOK otherwise.

- **String RecordPack() const**

  Convert record object into disk storage format as found in  return the resulting string.

- **int RecordPack(String& packed) const**

  Convert record object into disk storage format as found in  and place the result in **packed** string. Return OK if successfull, NOTOK otherwise.

- **inline int Pack(String& ckey, String& crecord) const**

  Short hand for KeyPack( **ckey** ) RecordPack( **crecord** ).

- **int Unpack(const String& ckey, const String& crecord)**

  Short hand for KeyUnpack( **ckey** ) RecordUnpack( **crecord** ).

- **int Merge(const WordReference& other)**

  Merge key with other.Key() using the *WordKey::Merge* method: key.Merge(other.Key()). See the corresponding manual page for details. Copy other.record into the record part of the object.

- **static WordReference Merge(const WordReference& master, const WordReference& slave)**

  Copy **master** before merging with **master.** Merge( **slave** ) and return the copy. Prevents alteration of **master**

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

  Set the whole structure from ASCII string in **bufferin** See *ASCII FORMAT* section. Return OK if successfull, NOTOK otherwise.

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

  Convert the whole structure to an ASCII string description  in **bufferout.** See *ASCII FORMAT* section. Return OK if successfull, NOTOK otherwise.

- **String Get() const**

  Convert the whole structure to an ASCII string description  and return it. See *ASCII FORMAT* section.

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

  Print object in ASCII form on **f** (uses *Get* method). See *ASCII FORMAT* section.

- **void Print() const**

  Print object in ASCII form on **stdout** (uses *Get* method). See *ASCII FORMAT* section.

## 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), [WordRecord(3)](/WordRecord/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)
