The site index is an optional free text index for webapps that comes as standard. If deployed, it maps each word found within webapp page and article content, to the set of pages and articles in which the word appears. It is implemented directly as a hdbIndexText instance, without involving a data class or a data class repository.

Return TypeFunction nameArguments
hzEcodehdbADP::InitSiteIndex(hzString&,)

Declared in file: hzDatabase.h
Defined in file : hdbADP.cpp

Function Logic:

0:START 1:unknown 2:items 3:unknown 4:Return hzerr(E_SEQUENCE,This function has already been called) 5:unknown 6:Return hzerr(E_ARGUMENT,No application data directory) 7:S m_pSiteindex pClass rc 8:unknown 9:S rc 10:unknown 11:S rc 12:unknown 13:rc 14:unknown 15:rc 16:unknown 17:items 18:pRepos 19:unknown 20:items 21:rc 22:unknown 23:items 24:S rc 25:unknown 26:items 27:rc 28:unknown 29:items 30:items rc items 31:Return rc

Function body:

hzEcode hdbADP::InitSiteIndex (hzString& dataDir)
{
   //  The site index is an optional free text index for webapps that comes as standard. If deployed, it maps each word found within webapp page and article content, to the set of
   //  pages and articles in which the word appears. It is implemented directly as a hdbIndexText instance, without involving a data class or a data class repository.
   _hzfunc("hdbADP::InitSiteIndex") ;
   hdbClass*       pClass ;        //  Subscriber class pointer
   hdbObjRepos*    pRepos ;        //  Subscriber repository pointer
   hzString        S ;             //  Temporary string
   hzEcode         rc ;            //  Return code
   if (!this)          hzexit(E_CORRUPT, "No ADP instance") ;
   if (m_pSiteindex)   return hzerr(E_SEQUENCE, "This function has already been called") ;
   if (!dataDir)       return hzerr(E_ARGUMENT, "No application data directory") ;
   S = "siteindex" ;
   m_pSiteindex = new hdbIndexText() ;
   //  Allocate and initialize subscriber class
   pClass = new hdbClass(*this, HDB_CLASS_DESIG_SYS) ;
   rc = pClass->InitStart(S) ;
   if (rc == E_OK) { S = "pageUrl" ;   rc = pClass->InitMember(S, datatype_STRING, HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { S = "PageTitle" ; rc = pClass->InitMember(S, datatype_STRING, HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK)
   {
       rc = pClass->InitDone() ;
   }
   //  Resister subscriber class
   if (rc == E_OK)
       rc = RegisterDataClass(pClass) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber class") ;
   //  Create and initialize susscriber repository
   pRepos = new hdbObjRepos(*this) ;
   if (!pRepos)
       hzexit(E_MEMORY, "No subsciber cache allocated") ;
   rc = pRepos->InitStart(pClass, pClass->strType(), dataDir, HDB_REPOS_CACHE) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos") ;
   S = "pageUrl" ;
   rc = pRepos->InitMbrIndex(S, true) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos index") ;
   rc = pRepos->InitDone() ;
   if (rc != E_OK)
       hzexit(rc, "Could not complete subsriber repos initialization") ;
   threadLog("Complete subsriber repos initialization") ;
   //  Resister subscriber repository
   rc = m_mapObjRepos.Insert(pRepos->strName(), pRepos) ;
   threadLog("Subscriber Repos Reg complete\n") ;
   return rc ;
}