STORING AND RETRIEVING RECORD IDENTIFIERS
Often it is useful to be able to store a record identifier with every record indexed. This typically is used to coordinate the Onix's index with the index of another database system.
The data used as a record's identifier can be either ASCII/ANSI characters or may be purely binary data. It is limited to 127 bytes in length.
If a new record identifier is added which is a duplicate of a previously existing record identifier, the new record's identifier supersedes the old record identifier during a lookup via ixFindRecordID. Calls to ixFindRecordID which find duplicates mark as deleted records with duplicated record ids retaining the newest record. (Duplicates do not superseded each other during a call to ixRetrieveRecordID. So depending on your situation, you may want to check to see if the record id has been superseded by a call to ixFindRecordID.)
Record ids are stored in either a fixed length or variable length format. Storing record ids in a variable length format allows record ids to be stored in such a way that record ids may be anywhere from 1 to 127 bytes in length. If record ids are stored in a fixed length format, all record ids must be the same size and the lookup speed to retrieve the record id for a given record is slightly faster than the variable length format.
The function ixProcessRecordID gives you the option of both whether the record id is stored and if the record ids are indexed. This allows you, some flexibility as to how record ids are stored and handled internally to the index. If a record id is indexed and not stored however, ixRetrieveRecordID will not work since there is nowhere to retrieve it from. If a record id is stored but not indexed, you can not locate it via ixFindRecordID but you can retrieve it via ixRetrieveRecordID.
To store record ids in your index, you will need to set up your index for storing this information at the time you create it with ixCreateIndexEx. There are several index creation parameters that need to be set. These are:
- ixSetVariableLengthRecordID -- If you want to store record ids in a variable length format within the index.
- ixSetFixedLengthRecordID -- If you would like to store record ids in a fixed length format within the index.
- ixSetRecordID32BitOffset -- Stores the record id offsets as 32 bit unsigned integers. This is what is used for virtually all systems and indexes.
- ixSetRecordID64BitOffset -- Stores the record id offsets as 64 bit unsigned integers. This is only used for 64 bit operating systems.
These settings are set using the function ixSetIndexCreationParams.
Note: If you store one record id in the index, record ids must be stored with every record indexed. If not, errors may occur.