Fixing divide by zero error in IndexBuilder NIHVIVO-1974

Fixing odd return of moniker that was causing cast exception.
Fixing ERROR message about temporary index build directory.
This commit is contained in:
bdc34 2011-02-01 20:30:10 +00:00
parent 4e18504ca0
commit e8667d3a8e
3 changed files with 35 additions and 27 deletions

View file

@ -333,12 +333,15 @@ public class IndexBuilder {
if( (count % 100 ) == 0 && count > 0 ){
long dt = (System.currentTimeMillis() - starttime);
log.debug("individuals indexed: " + count + " in " + dt + " msec " +
" time pre individual = " + (dt / count) + " msec");
" time pre individual = " + (dt / count) + " msec" );
}
}
}
log.info("individuals indexed: " + count + " in " + (System.currentTimeMillis() - starttime) + " msec" +
" time per individual = " + (System.currentTimeMillis() - starttime)/ count + " msec") ;
log.info(
"individuals indexed: " + count + " in " + (System.currentTimeMillis() - starttime) + " msec" +
(count!=0?(" time per individual = " + (System.currentTimeMillis() - starttime)/ count + " msec"):"")
);
}
/**

View file

@ -119,7 +119,7 @@ public class Entity2LuceneDoc implements Obj2DocIface{
//log.debug("Skipping individual without rdfs:label " + ent.getURI());
//return null;
log.debug("Using local name for individual with rdfs:label " + ent.getURI());
return ent.getLocalName();
value = ent.getLocalName();
}
Field name =new Field(term.NAME, value,
Field.Store.YES, Field.Index.ANALYZED);

View file

@ -203,9 +203,9 @@ public class LuceneIndexer implements IndexerIface {
if( urisIndexed.contains(ind.getURI()) ){
log.debug("already indexed " + ind.getURI() );
return;
}else
}else{
urisIndexed.add(ind.getURI());
log.debug("indexing " + ind.getURI());
Iterator<Obj2DocIface> it = getObj2DocList().iterator();
while (it.hasNext()) {
Obj2DocIface obj2doc = (Obj2DocIface) it.next();
@ -225,6 +225,7 @@ public class LuceneIndexer implements IndexerIface {
}
}
}
}
} catch (IOException ex) {
throw new IndexingException(ex.getMessage());
}
@ -280,10 +281,14 @@ public class LuceneIndexer implements IndexerIface {
File offLineDir = new File(currentOffLineDir);
File liveDir = new File(liveIndexDir);
boolean success = offLineDir.renameTo( liveDir );
if( ! success )
if( ! success ){
log.error("could not move off line index at "
+ offLineDir.getAbsolutePath() + " to live index directory "
+ liveDir.getAbsolutePath());
}else{
deleteDir(new File(currentOffLineDir));
currentOffLineDir = null;
}
}
private synchronized String getOffLineBuildDir(){