From a17c5ab3e7ffe611c15ace603bb4fd6c807db5e6 Mon Sep 17 00:00:00 2001 From: William Au Date: Tue, 18 Jul 2006 12:53:58 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 1 + src/java/org/apache/solr/core/SolrCore.java | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d2015f48a06..ed17345139e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -68,5 +68,6 @@ Other Changes 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) 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 diff --git a/src/java/org/apache/solr/core/SolrCore.java b/src/java/org/apache/solr/core/SolrCore.java index ba49d2fa1b1..30720ab874c 100644 --- a/src/java/org/apache/solr/core/SolrCore.java +++ b/src/java/org/apache/solr/core/SolrCore.java @@ -28,6 +28,7 @@ import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryResponse; import org.apache.solr.request.XMLResponseWriter; import org.apache.solr.schema.IndexSchema; +import org.apache.solr.schema.SchemaField; import org.apache.solr.search.SolrIndexSearcher; import org.apache.solr.update.*; import org.apache.solr.util.DOMUtil; @@ -693,7 +694,14 @@ public final class SolrCore { cmd.doc = builder.getDoc(); log.finest("adding doc..."); 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(""); } catch (SolrException e) { log(e);