- Lextek Products
There are two ways to create indexes. The first is to use ixCreateIndex. This function is designed to be easy to use and to allow people to get a simple index up and going in the least time and the least possible effort.
If you need certain additional functionality and control you should use the function ixCreateIndexEx. You pass ixCreateIndexEx settings created in an "IndexCreationParams" object. The parameters, created with ixSetIndexCreationParams, determine things such as whether the index is a distributed index, the indexing mode, and other options Onix gives you. By passing parameters in this fashion, we can easily add more features to Onix wihtout changing how you create the index. This will make your code easier to maintain.
Some of options for Onix that ixCreateIndexEx allows you are:
- Distributed Indexes -- The index may be spread across multiple files allowing the index to grow beyond the 2GB file size limit set by many operating systems. A distributed index is capable of indexing and searching terabytes of data.
- Record Info -- Record Data may be stored along with every record. This can be a URL, the text indexed, an image, or just about anything else.
- Record ID -- An optional record identifier which you can use to identify a record.
Most people do not need these advanced features and ixCreateIndex is sufficient.
Here is some partial code showing how you create an indexe with the extended creation method. Note that some parts of the code have been deleted for space and clarity. In particular these code fragments don't include error checking. In your applications you should always check Status after making a function call with Onix.
// Note that you must fill in the pass codes with your actual passcodes
indexManager = ixCreateIndexManager( PASS1, PASS2, Status);
indexCreationParams = ixCreateIndexCreationParams( Status );
ixSetSinglePointIndex, NULL );
(void*) "c:\\indexes\\index.idx" );
ixSetRankingMethodTwo, NULL );
IndexingMode = (IndexModeT) 2;
ixSetIndexMode, &IndexingMode );
ixSet32BitRecordInfoOffset, NULL );
ixSetVariableLengthRecordInfo, NULL );
ixCreateIndexEx( indexManager, indexCreationParams,
ixDeleteIndexCreationParams( indexCreationParams );
ixOpenIndex( indexManager, "c:\\indexes\\index.idx",
ixCreateIndexCreationParams, ixDeleteIndexCreationParams, ixSetIndexCreationParams, ixCreateIndex, ixCreateIndexEx