VIVO-869 A full re-inference invokes a full re-index.
IndexingChangeListener is also modified to listen for the beginning of a re-index, and discard any changes it has accumulated.
This commit is contained in:
parent
d25176298d
commit
b213718a72
2 changed files with 14 additions and 2 deletions
|
@ -108,6 +108,7 @@ public class ABoxRecomputer {
|
||||||
recomputeABox();
|
recomputeABox();
|
||||||
} finally {
|
} finally {
|
||||||
if (searchIndexer != null) {
|
if (searchIndexer != null) {
|
||||||
|
searchIndexer.rebuildIndex();
|
||||||
searchIndexer.unpause();
|
searchIndexer.unpause();
|
||||||
}
|
}
|
||||||
synchronized (lock1) {
|
synchronized (lock1) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.searchindex;
|
package edu.cornell.mannlib.vitro.webapp.searchindex;
|
||||||
|
|
||||||
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.PAUSE;
|
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.PAUSE;
|
||||||
|
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.START_REBUILD;
|
||||||
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.UNPAUSE;
|
import static edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type.UNPAUSE;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
@ -24,6 +25,7 @@ import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||||
import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer;
|
import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer;
|
||||||
import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event;
|
import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer.Event.Type;
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.ChangeListener;
|
import edu.cornell.mannlib.vitro.webapp.rdfservice.ChangeListener;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread;
|
import edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread;
|
||||||
|
|
||||||
|
@ -34,6 +36,9 @@ import edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread;
|
||||||
*
|
*
|
||||||
* When the SearchIndexer pauses, stop sending changes until the SearchIndexer
|
* When the SearchIndexer pauses, stop sending changes until the SearchIndexer
|
||||||
* unpauses.
|
* unpauses.
|
||||||
|
*
|
||||||
|
* If the SearchIndexer begins a rebuild, discard any changes that we had
|
||||||
|
* accumulated. They will be accomplished by the rebuild.
|
||||||
*/
|
*/
|
||||||
public class IndexingChangeListener implements ChangeListener,
|
public class IndexingChangeListener implements ChangeListener,
|
||||||
SearchIndexer.Listener {
|
SearchIndexer.Listener {
|
||||||
|
@ -51,7 +56,7 @@ public class IndexingChangeListener implements ChangeListener,
|
||||||
this.searchIndexer = searchIndexer;
|
this.searchIndexer = searchIndexer;
|
||||||
this.ticker = new Ticker();
|
this.ticker = new Ticker();
|
||||||
this.changes = new ArrayList<>();
|
this.changes = new ArrayList<>();
|
||||||
|
|
||||||
searchIndexer.addListener(this);
|
searchIndexer.addListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +73,9 @@ public class IndexingChangeListener implements ChangeListener,
|
||||||
paused = true;
|
paused = true;
|
||||||
} else if (event.getType() == UNPAUSE) {
|
} else if (event.getType() == UNPAUSE) {
|
||||||
paused = false;
|
paused = false;
|
||||||
respondToTicker();
|
ticker.start();
|
||||||
|
} else if (event.getType() == START_REBUILD) {
|
||||||
|
discardChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +85,10 @@ public class IndexingChangeListener implements ChangeListener,
|
||||||
changes.clear();
|
changes.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void discardChanges() {
|
||||||
|
changes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
ticker.shutdown();
|
ticker.shutdown();
|
||||||
|
|
Loading…
Add table
Reference in a new issue