(SM) Support Tip: Troubleshooting tips for Smart analytics indexing not working.

Many customer faced below issue :

When they are trying to configure smart search all is OK until they will hit the "full index" button and nothing will happen. All libraries will be and stay in status "Not started" checked the debug log but cannot find rootcasue .

 

For this situation we can do the troubleshooting by adding more print(...) code lines in related SLs.

 For example, KMUpdate scheduler calls SL: lib.IDOL_Utilities.scheduleKMUpdate();

 In SL: IDOL_Utilities, we can add more print(...) after each key call:

 function scheduleKMUpdate() {            

                var idolConfig = lib.IDOLConfigure.require();

                idolConfig.clearIDOLServerConfigCache();

                lib.jsaci.clearIDOLServer();

 

                var idolEnabled = idolConfig.getConfig()['enable'];

                if (idolEnabled) {

                                vars.$G_kmsearchengine = 'IDOL';

                }

 

                if('IDOL' == vars.$G_kmsearchengine) {

                                lib.KMCollection_Update_IDOL.require().refreshIndexes();

                                print("lib.KMCollection_Update_IDOL.require().refreshIndexes finished.");

                                system.functions.rtecall("log", vars['$L.rtn'], "lib.KMCollection_Update_IDOL.require().refreshIndexes finished.");

                }

                else {

                                lib.KMCollection_Update.refreshIndexes();

                }

 

                lib.KMUtils.getIndexedSCFileArray();

                print("lib.KMUtils.getIndexedSCFileArray finished.");

                system.functions.rtecall("log", vars['$L.rtn'], "lib.KMUtils.getIndexedSCFileArray finished.");               

}

 

Similarly, we can add more print(...) in above yellow highlighted SL functions.

With the additional debug messages, we can know on which point, the function might have failed, and then we can further do troubleshooting.

If that still not help we can  add more debug code to print debug log messages.

- Open KMCollection_Update_IDOL, replace function fullIndex() with following code, try Full Reindex again

>>>>>>        

function fullIndex(){             var freindex = new SCFile("kmreindex"),                 ret = freindex.doSelect("true"); logger.info('full index : 1');             while(ret === RC_SUCCESS) {                         try {                       var kbname = freindex.collectionname,                           sclibtablename = freindex.sclibtablename,                           scquery = freindex.scquery,                           record_number = freindex.record_number,                           collectionFile = new SCFile("kmknowledgebase"),                           result = collectionFile.doSelect('kbname="' kbname '"');                       var isReindex = IDOLKMIndexService.isDBExists(kbname IDOLKMIndexService.tempDBPostFix()); logger.info('full index : kbname : ' kbname); logger.info('full index : sclibtablename : ' sclibtablename); logger.info('full index : record_number : ' record_number); logger.info('full index : 2');                       if(RC_SUCCESS !== result){                           return -1;                       } logger.info('full index : 3');                       logger.info('full index for ' freindex.collectionname ' started');                             //set indexstatus to 'indexing'                       if (collectionFile.indexstatus !== lib.KMCollection_Status_Constant.INDEXSTATUS_OFFLINE()) { logger.info('full index : 4');                           collectionFile.indexstatus = lib.KMCollection_Status_Constant.INDEXSTATUS_INDEXING();                           collectionFile.doUpdate();                       }                             var sclibFile = new SCFile(sclibtablename);                       result = sclibFile.doSelect(scquery);                             var indexFieldSet = KMIDOLUtils.getIndexFieldSet(collectionFile);                       var currRec = 0; logger.info('full index : 5');                       while(RC_SUCCESS === result && record_number  && currRec < record_number) {                           currRec ;                           vars.$L_currRec = currRec;                           result = sclibFile.getNext();                       } logger.info('full index : 6');                       while(RC_SUCCESS === result){                                 currRec ;                           vars.$L_currRec = currRec;                                 try{ logger.info('full index : 7');                             result = KMDocument_Index_IDOL.indexDocument(collectionFile, sclibFile, indexFieldSet,isReindex); logger.info('full index : 8');                           } catch(ex){                             result = -1;                             logger.error(ex.message);                             logger.error(ex.stack);                           }                           if(RC_SUCCESS != result) { logger.info('full index : 9');                               //insert into kmknowledgebaseupdates for further retry                               var ret = lib.IDOLKMIncrementalIndex.verifyEnvironment();                                     if (ret !=0) { logger.info('full index : 10');                                   result = lib.KMCollection_Update_Utils.getKMUpdateProcState();                                   if (result == true) {                                       result = lib.KMCollection_Update_Utils.stopKMUpdate();                                   }                                         freindex.record_number = --currRec;                                   freindex.doUpdate();                                   return -1;                               }else{ logger.info('full index : 11');                                   var kmuFile = new SCFile("kmknowledgebaseupdates");                                   kmuFile.id = lib.KMCollection_Update_Utils.getNextKMUpdateId();                                   kmuFile.collectionname = kbname;                                   kmuFile.docid = sclibFile[collectionFile.docid] "";                                   kmuFile.recdata = lib.KMUtils.recordToXML(sclibFile);                                   kmuFile.sedocid = kbname "_" kmuFile.docid "_0";                                   kmuFile.action = "U";                                   kmuFile.doInsert();                               }                           }                                 if(currRec % 1000 == 0) {                               freindex.record_number = currRec;                               freindex.doUpdate();                           }                           result = sclibFile.getNext();                       } logger.info('full index : 12');                             freindex.record_number = currRec;                       freindex.action = "D";                             freindex.doUpdate();                                             if(isReindex){ logger.info('full index : 13');                           IDOLKMIndexService.renameIndexDB(kbname,kbname '_old_');                           IDOLKMIndexService.flushIndexData();                           IDOLKMIndexService.renameIndexDB(kbname IDOLKMIndexService.tempDBPostFix(),kbname);                           ret = IDOLKMIndexService.mappingVDB(kbname);                           if( ret == RC_SUCCESS){ logger.info('full index : 14');                             IDOLKMIndexService.removeIndexDB(kbname '_old_');                           }else{ logger.info('full index : 15');                             logger.error('Reindex for ' kbname ' finished but failed to map VDB');                             return -1;                           }                       }                                              logger.info('full index for ' freindex.collectionname ' finished');                       //set indexstatus to 'finished'                       if (collectionFile.indexstatus !== lib.KMCollection_Status_Constant.INDEXSTATUS_OFFLINE()) {                           collectionFile.indexstatus = lib.KMCollection_Status_Constant.INDEXSTATUS_FINISHED();                           var endDate = new Date();                           collectionFile.lastindextime = endDate;                           collectionFile.doUpdate();                       }                             ret = freindex.getNext();                         } catch (ex) {                                                             logger.error('error when doing full index ' freindex.collectionname ', exception:' ex);                               logger.error(ex.stack);                               return -1;                         }             }             return RC_SUCCESS;         }

 

>>>>>>

 if customer could reproduce the issue, is would be best for us to get:

1) Customer database

2) ScriptLibrary unload with name starting with KM*

thanks

Tags: