Commit Solr index before simulating or starting recrawl job.

This ensures up-to-date simulation query results, and recrawl
processing.
pull/157/head
luccioman 7 years ago
parent 5b943c07ab
commit 8b572b7337

@ -164,8 +164,10 @@ public class IndexReIndexMonitor_p {
}
} else if(post.containsKey("simulateRecrawl")) {
final SolrConnector solrConnector = sb.index.fulltext().getDefaultConnector();
if (!solrConnector.isClosed()) {
if (solrConnector != null && !solrConnector.isClosed()) {
try {
/* Ensure indexed data is up-to-date */
solrConnector.commit(true);
// query all or only httpstatus=200 depending on includefailed flag
final String finalQuery = RecrawlBusyThread.buildSelectionQuery(recrawlQuery, inclerrdoc);
final long count = solrConnector.getCountByQuery(finalQuery);

@ -129,6 +129,12 @@ public class RecrawlBusyThread extends AbstractBusyThread {
// org.apache.solr.core.SolrCore java.lang.IllegalStateException: unexpected docvalues type NONE for field 'load_date_dt' (expected=NUMERIC). Use UninvertingReader or index with docvalues.
this.solrSortBy = null; // CollectionSchema.load_date_dt.getSolrFieldName() + " asc";
this.chunksize = sb.getConfigInt(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 200);
final SolrConnector solrConnector = this.sb.index.fulltext().getDefaultConnector();
if (solrConnector != null && !solrConnector.isClosed()) {
/* Ensure indexed data is up-to-date before running the main job */
solrConnector.commit(true);
}
}
/**
@ -265,7 +271,7 @@ public class RecrawlBusyThread extends AbstractBusyThread {
}
SolrDocumentList docList = null;
final SolrConnector solrConnector = sb.index.fulltext().getDefaultConnector();
if (solrConnector.isClosed()) {
if (solrConnector == null || solrConnector.isClosed()) {
this.urlsToRecrawl = 0;
this.terminatedBySolrFailure = true;
return false;

Loading…
Cancel
Save