Included unique key field name/value (if available) in log message of add: SOLR-18)

git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@423076 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William Au 2006-07-18 12:53:58 +00:00
parent f2b5656245
commit a17c5ab3e7
2 changed files with 10 additions and 1 deletions

View File

@ -68,5 +68,6 @@ Other Changes
http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=markup&pathrev=416224 http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=markup&pathrev=416224
2. Modified admin styles to improve display in Internet Explorer (Greg Ludington via billa, SOLR-6) 2. Modified admin styles to improve display in Internet Explorer (Greg Ludington via billa, SOLR-6)
3. Upgrade to Lucene 2.0 nightly build 2006-07-15, lucene SVN revision 422302, 3. Upgrade to Lucene 2.0 nightly build 2006-07-15, lucene SVN revision 422302,
4. Included unique key field name/value (if available) in log message of add (billa, SOLR-18)
2006/01/17 Solr open sourced, moves to Apache Incubator 2006/01/17 Solr open sourced, moves to Apache Incubator

View File

@ -28,6 +28,7 @@ import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrQueryResponse; import org.apache.solr.request.SolrQueryResponse;
import org.apache.solr.request.XMLResponseWriter; import org.apache.solr.request.XMLResponseWriter;
import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.search.SolrIndexSearcher; import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.update.*; import org.apache.solr.update.*;
import org.apache.solr.util.DOMUtil; import org.apache.solr.util.DOMUtil;
@ -693,7 +694,14 @@ public final class SolrCore {
cmd.doc = builder.getDoc(); cmd.doc = builder.getDoc();
log.finest("adding doc..."); log.finest("adding doc...");
updateHandler.addDoc(cmd); updateHandler.addDoc(cmd);
log.info("add "+status+" "+(System.currentTimeMillis()-startTime)); SchemaField uniqueKeyField = schema.getUniqueKeyField();
StringBuilder addMsg = new StringBuilder("add ");
if (uniqueKeyField!=null) addMsg.append("(")
.append(uniqueKeyField.getName())
.append("=")
.append(schema.printableUniqueKey(cmd.doc))
.append(") ");
log.info(addMsg.toString()+status+" "+(System.currentTimeMillis()-startTime));
writer.write("<result status=\"" + status + "\"></result>"); writer.write("<result status=\"" + status + "\"></result>");
} catch (SolrException e) { } catch (SolrException e) {
log(e); log(e);