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:
parent
4e18504ca0
commit
e8667d3a8e
3 changed files with 35 additions and 27 deletions
|
@ -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"):"")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -203,28 +203,29 @@ public class LuceneIndexer implements IndexerIface {
|
|||
if( urisIndexed.contains(ind.getURI()) ){
|
||||
log.debug("already indexed " + ind.getURI() );
|
||||
return;
|
||||
}else
|
||||
}else{
|
||||
urisIndexed.add(ind.getURI());
|
||||
|
||||
Iterator<Obj2DocIface> it = getObj2DocList().iterator();
|
||||
while (it.hasNext()) {
|
||||
Obj2DocIface obj2doc = (Obj2DocIface) it.next();
|
||||
if (obj2doc.canTranslate(ind)) {
|
||||
Document d = (Document) obj2doc.translate(ind);
|
||||
if( d != null){
|
||||
if( !newDoc ){
|
||||
writer.updateDocument((Term)obj2doc.getIndexId(ind), d);
|
||||
log.debug("updated " + ind.getName() + " " + ind.getURI());
|
||||
}else{
|
||||
writer.addDocument(d);
|
||||
log.debug("added " + ind.getName() + " " + ind.getURI());
|
||||
}
|
||||
}else{
|
||||
log.debug("could not translate, removing from index " + ind.getURI());
|
||||
writer.deleteDocuments((Term)obj2doc.getIndexId(ind));
|
||||
log.debug("indexing " + ind.getURI());
|
||||
Iterator<Obj2DocIface> it = getObj2DocList().iterator();
|
||||
while (it.hasNext()) {
|
||||
Obj2DocIface obj2doc = (Obj2DocIface) it.next();
|
||||
if (obj2doc.canTranslate(ind)) {
|
||||
Document d = (Document) obj2doc.translate(ind);
|
||||
if( d != null){
|
||||
if( !newDoc ){
|
||||
writer.updateDocument((Term)obj2doc.getIndexId(ind), d);
|
||||
log.debug("updated " + ind.getName() + " " + ind.getURI());
|
||||
}else{
|
||||
writer.addDocument(d);
|
||||
log.debug("added " + ind.getName() + " " + ind.getURI());
|
||||
}
|
||||
}else{
|
||||
log.debug("could not translate, removing from index " + ind.getURI());
|
||||
writer.deleteDocuments((Term)obj2doc.getIndexId(ind));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue