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 Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbADP::InitSiteIndex | (hzString&,) |
Declared in file: hzDatabase.h
Defined in file : hdbADP.cpp
Function Logic:
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 ;
}