IB Developer's C++-language API

Although the IB engine is written in C++ one generally does not— except for callbacks and ranking algorithms where ultimate execution speed are demanded— develop applications in C++ but typically one of the script languages

  • Python
  • Tcl
  • Perl
  • Ruby
  • Java
  • PHP
These languages are convenient for application development beyond even rapid prototyping and provide excellent performance and robustness. For most developers they are the first choice.


These higher level directly accessed classes execute quickly (as fast as native development since they are native) and are easy to use:

import sys
import string
from IB import *

query='chain test OR'

Db="BSNWEB";
pdb = VIDB(Db);
print "This is PyIB version %s/%s" % (string.split(sys.version)[0], pdb.GetVersionID());
print "Copyright (c) 1999 Basis Systeme netzwerk/Munich";
if not pdb.IsDbCompatible():
  raise ValueError, "The specified database '%s' is not compatible with this version. Re-index!" % `Db`
elements = pdb.GetTotalRecords();
print "Database ", Db, " has ", elements, " elements";
total = 10;
if elements > 0:
        rset = pdb.VSearchRpn(query, ByScore, 300, total); # RPN Query

At the core is a C++ API to which the interfaces are generated using SWIG and the following interface classes:

// Search Statistics
class IDB_STATS {
public:
  IDB_STATS();
  ~IDB_STATS();
  void SetHits(size_t nHits);
  void SetTotal(size_t nTotal);
  size_t GetTotal() const;
  size_t GetHits() const;
  void   Clear();
  void   SetName(const STRING newName);
  STRING GetName() const;
};

class VIDB_STATS {
public:
  VIDB_STATS();
  ~VIDB_STATS();
  void Clear();
  IDB_STATS operator[](size_t n) const;
  void SetTotal(size_t i, size_t total);
  void SetHits(size_t i, size_t total);
  void SetName(size_t i, const STRING Name);
};

class IDBOBJ {
public:
  IDBOBJ();
  ~IDBOBJ();

  bool getUseRelativePaths() const;
  bool setUseRelativePaths(bool val=1);

  STRING RelativizePathname(const STRING Path) const;
  STRING ResolvePathname(const STRING Path) const;
};

TO BE CONTINUED