mirror of https://github.com/apache/lucene.git
SOLR-2382 - regression . debug not working
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1152692 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
31e3b272c5
commit
5fca7fc938
|
@ -74,8 +74,6 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
|
||||
private Map<String, Properties> dataSources = new HashMap<String, Properties>();
|
||||
|
||||
private List<SolrInputDocument> debugDocuments;
|
||||
|
||||
private boolean debugEnabled = true;
|
||||
|
||||
private String myName = "dataimport";
|
||||
|
@ -203,10 +201,12 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
// Synchronous request for the debug mode
|
||||
importer.runCmd(requestParams, sw);
|
||||
rsp.add("mode", "debug");
|
||||
rsp.add("documents", debugDocuments);
|
||||
if (sw.debugLogger != null)
|
||||
rsp.add("verbose-output", sw.debugLogger.output);
|
||||
debugDocuments = null;
|
||||
rsp.add("documents", requestParams.debugDocuments);
|
||||
if (requestParams.debugVerboseOutput != null) {
|
||||
rsp.add("verbose-output", requestParams.debugVerboseOutput);
|
||||
}
|
||||
requestParams.debugDocuments = new ArrayList<SolrInputDocument>(0);
|
||||
requestParams.debugVerboseOutput = null;
|
||||
} else {
|
||||
message = DataImporter.MSG.DEBUG_NOT_ENABLED;
|
||||
}
|
||||
|
@ -285,11 +285,6 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
@Override
|
||||
public boolean upload(SolrInputDocument document) {
|
||||
try {
|
||||
if (requestParams.debug) {
|
||||
if (debugDocuments == null)
|
||||
debugDocuments = new ArrayList<SolrInputDocument>();
|
||||
debugDocuments.add(document);
|
||||
}
|
||||
return super.upload(document);
|
||||
} catch (RuntimeException e) {
|
||||
LOG.error( "Exception while adding: " + document, e);
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
package org.apache.solr.handler.dataimport;
|
||||
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.core.SolrConfig;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
import org.apache.solr.common.util.ContentStream;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.StrUtils;
|
||||
import org.apache.solr.common.util.SystemIdResolver;
|
||||
import org.apache.solr.common.util.XMLErrorLogger;
|
||||
|
@ -538,6 +540,10 @@ public class DataImporter {
|
|||
|
||||
public ContentStream contentStream;
|
||||
|
||||
public List<SolrInputDocument> debugDocuments = new ArrayList<SolrInputDocument>(0);
|
||||
|
||||
public NamedList debugVerboseOutput = null;
|
||||
|
||||
public RequestParams() {
|
||||
}
|
||||
|
||||
|
|
|
@ -72,11 +72,13 @@ public class DocBuilder {
|
|||
private static final String PARAM_WRITER_IMPL = "writerImpl";
|
||||
private static final String DEFAULT_WRITER_NAME = "SolrWriter";
|
||||
private DebugLogger debugLogger;
|
||||
private DataImporter.RequestParams reqParams;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public DocBuilder(DataImporter dataImporter, SolrWriter solrWriter, DIHPropertiesWriter propWriter, DataImporter.RequestParams reqParams) {
|
||||
INSTANCE.set(this);
|
||||
this.dataImporter = dataImporter;
|
||||
this.reqParams = reqParams;
|
||||
this.propWriter = propWriter;
|
||||
DataImporter.QUERY_COUNT.set(importStatistics.queryCount);
|
||||
requestParameters = reqParams;
|
||||
|
@ -261,6 +263,9 @@ public class DocBuilder {
|
|||
{
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
if(requestParameters.debug) {
|
||||
requestParameters.debugVerboseOutput = getDebugLogger().output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -514,6 +519,9 @@ public class DocBuilder {
|
|||
LOG.debug("adding a doc "+docWrapper);
|
||||
}
|
||||
boolean result = writer.upload(docWrapper);
|
||||
if(reqParams.debug) {
|
||||
reqParams.debugDocuments.add(docWrapper);
|
||||
}
|
||||
docWrapper = null;
|
||||
if (result){
|
||||
importStatistics.docCount.incrementAndGet();
|
||||
|
@ -672,6 +680,9 @@ public class DocBuilder {
|
|||
return;
|
||||
if (!doc.isEmpty()) {
|
||||
boolean result = writer.upload(doc);
|
||||
if(reqParams.debug) {
|
||||
reqParams.debugDocuments.add(doc);
|
||||
}
|
||||
doc = null;
|
||||
if (result){
|
||||
importStatistics.docCount.incrementAndGet();
|
||||
|
|
|
@ -44,8 +44,6 @@ public class SolrWriter implements DIHWriter {
|
|||
|
||||
private final UpdateRequestProcessor processor;
|
||||
|
||||
DebugLogger debugLogger;
|
||||
|
||||
SolrQueryRequest req;
|
||||
|
||||
public SolrWriter(UpdateRequestProcessor processor, SolrQueryRequest req) {
|
||||
|
|
Loading…
Reference in New Issue