lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1430130 [25/27] - in /lucene/dev/branches/lucene4547: ./ dev-tools/ dev-tools/eclipse/ dev-tools/idea/.idea/libraries/ dev-tools/maven/ dev-tools/maven/solr/ dev-tools/maven/solr/contrib/analysis-extras/ dev-tools/maven/solr/contrib/cluste...
Date Tue, 08 Jan 2013 03:40:37 GMT
Modified: lucene/dev/branches/lucene4547/solr/example/etc/jetty.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/etc/jetty.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/etc/jetty.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/etc/jetty.xml Tue Jan  8 03:40:16 2013
@@ -12,12 +12,6 @@
 
 <Configure id="Server" class="org.eclipse.jetty.server.Server">
 
-    <!-- Increase the maximum POST size to 1 MB to be able to handle large shard requests -->
-    <Call name="setAttribute">
-      <Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg>
-      <Arg>200000</Arg>
-    </Call>
-
     <!-- =========================================================== -->
     <!-- Server Thread Pool                                          -->
     <!-- =========================================================== -->
@@ -100,7 +94,7 @@
                 <Set name="filename">
                    logs/request.yyyy_mm_dd.log
                 </Set>
-                <Set name="filenameDateFormat">yyyy_mm_dd</Set>
+                <Set name="filenameDateFormat">yyyy_MM_dd</Set>
                 <Set name="retainDays">90</Set>
                 <Set name="append">true</Set>
                 <Set name="extended">false</Set>

Modified: lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/db/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/db/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/db/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/db/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -217,7 +217,7 @@
     -->
   <requestDispatcher handleSelect="true" >
     <!--Make sure your system has some authentication before enabling remote streaming!  -->
-    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
         
     <!-- Set HTTP caching related parameters (for proxy caches and clients).
           

Modified: lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/mail/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/mail/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/mail/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -249,7 +249,7 @@
     -->
   <requestDispatcher handleSelect="true" >
     <!--Make sure your system has some authentication before enabling remote streaming!  -->
-    <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" />
+    <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" formdataUploadLimitInKB="2048" />
 
     <!-- Set HTTP caching related parameters (for proxy caches and clients).
 

Modified: lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/rss/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/rss/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/rss/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/rss/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -217,7 +217,7 @@
     -->
   <requestDispatcher handleSelect="true" >
     <!--Make sure your system has some authentication before enabling remote streaming!  -->
-    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
         
     <!-- Set HTTP caching related parameters (for proxy caches and clients).
           

Modified: lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/solr/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/solr/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -217,7 +217,7 @@
     -->
   <requestDispatcher handleSelect="true" >
     <!--Make sure your system has some authentication before enabling remote streaming!  -->
-    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
         
     <!-- Set HTTP caching related parameters (for proxy caches and clients).
           

Modified: lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/tika/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/tika/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/tika/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/example-DIH/solr/tika/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -188,7 +188,7 @@
     -->
   <requestDispatcher handleSelect="true" >
     <!--Make sure your system has some authentication before enabling remote streaming!  -->
-    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
         
     <!-- Set HTTP caching related parameters (for proxy caches and clients).
           

Modified: lucene/dev/branches/lucene4547/solr/example/multicore/core0/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/multicore/core0/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/multicore/core0/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/multicore/core0/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -47,7 +47,7 @@
   <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" /> 
 
   <requestDispatcher handleSelect="true" >
-    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
   </requestDispatcher>
   
   <requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />

Modified: lucene/dev/branches/lucene4547/solr/example/multicore/core1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/multicore/core1/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/multicore/core1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/multicore/core1/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -47,7 +47,7 @@
   <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" /> 
 
   <requestDispatcher handleSelect="true" >
-    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+    <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
   </requestDispatcher>
   
   <requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />

Modified: lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/lang/contractions_fr.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/lang/contractions_fr.txt?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/lang/contractions_fr.txt (original)
+++ lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/lang/contractions_fr.txt Tue Jan  8 03:40:16 2013
@@ -7,3 +7,9 @@ qu
 n
 s
 j
+d
+c
+jusqu
+quoiqu
+lorsqu
+puisqu

Modified: lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/solrconfig.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/solrconfig.xml Tue Jan  8 03:40:16 2013
@@ -657,9 +657,14 @@
          enableRemoteStreaming - enables use of the stream.file
          and stream.url parameters for specifying remote streams.
 
-         multipartUploadLimitInKB - specifies the max size of
+         multipartUploadLimitInKB - specifies the max size (in KiB) of
          Multipart File Uploads that Solr will allow in a Request.
          
+         formdataUploadLimitInKB - specifies the max size (in KiB) of
+         form data (application/x-www-form-urlencoded) sent via
+         POST. You can use POST to pass request parameters not
+         fitting into the URL.
+         
          *** WARNING ***
          The settings below authorize Solr to fetch remote files, You
          should make sure your system has some authentication before
@@ -667,7 +672,8 @@
 
       --> 
     <requestParsers enableRemoteStreaming="true" 
-                    multipartUploadLimitInKB="2048000" />
+                    multipartUploadLimitInKB="2048000"
+                    formdataUploadLimitInKB="2048"/>
 
     <!-- HTTP Caching
 

Modified: lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/velocity/richtext-doc.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/velocity/richtext-doc.vm?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/velocity/richtext-doc.vm (original)
+++ lucene/dev/branches/lucene4547/solr/example/solr/collection1/conf/velocity/richtext-doc.vm Tue Jan  8 03:40:16 2013
@@ -1,3 +1,59 @@
+## Mimetype to extension map for detecting file type and show icon
+## List of types match the icons in /solr/img/filetypes
+#set($extMap = {"application/x-7z-compressed": "7z",
+                 "application/postscript": "ai",
+                 "application/pgp-signature": "asc",
+                 "application/octet-stream": "bin",
+                 "application/x-bzip2": "bz2",
+                 "text/x-c": "c",
+                 "application/vnd.ms-htmlhelp": "chm",
+                 "application/java-vm": "class",
+                 "text/css": "css",
+                 "text/csv": "csv",
+                 "application/x-debian-package": "deb",
+                 "application/msword": "doc",
+                 "message/rfc822": "eml",
+                 "image/gif": "gif",
+                 "application/winhlp": "hlp",
+                 "text/html": "html",
+                 "application/java-archive": "jar",
+                 "text/x-java-source": "java",
+                 "image/jpeg": "jpeg",
+                 "application/javascript": "js",
+                 "application/vnd.oasis.opendocument.chart": "odc",
+                 "application/vnd.oasis.opendocument.formula": "odf",
+                 "application/vnd.oasis.opendocument.graphics": "odg",
+                 "application/vnd.oasis.opendocument.image": "odi",
+                 "application/vnd.oasis.opendocument.presentation": "odp",
+                 "application/vnd.oasis.opendocument.spreadsheet": "ods",
+                 "application/vnd.oasis.opendocument.text": "odt",
+                 "application/pdf": "pdf",
+                 "application/pgp-encrypted": "pgp",
+                 "image/png": "png",
+                 "application/vnd.ms-powerpoint": "ppt",
+                 "audio/x-pn-realaudio": "ram",
+                 "application/x-rar-compressed": "rar",
+                 "application/vnd.rn-realmedia": "rm",
+                 "application/rtf": "rtf",
+                 "application/x-shockwave-flash": "swf",
+                 "application/vnd.sun.xml.calc": "sxc",
+                 "application/vnd.sun.xml.draw": "sxd",
+                 "application/vnd.sun.xml.impress": "sxi",
+                 "application/vnd.sun.xml.writer": "sxw",
+                 "application/x-tar": "tar",
+                 "application/x-tex": "tex",
+                 "text/plain": "txt",
+                 "text/x-vcard": "vcf",
+                 "application/vnd.visio": "vsd",
+                 "audio/x-wav": "wav",
+                 "audio/x-ms-wma": "wma",
+                 "video/x-ms-wmv": "wmv",
+                 "application/vnd.ms-excel": "xls",
+                 "application/xml": "xml",
+                 "application/x-xpinstall": "xpi",
+                 "application/zip": "zip"})
+
+
 #if($doc.getFieldValue('title'))
   #set($title = $esc.html($doc.getFirstValue('title')))
 #else
@@ -13,10 +69,16 @@
 #set($supportedtypes = "7z;ai;aiff;asc;audio;bin;bz2;c;cfc;cfm;chm;class;conf;cpp;cs;css;csv;deb;divx;doc;dot;eml;enc;file;gif;gz;hlp;htm;html;image;iso;jar;java;jpeg;jpg;js;lua;m;mm;mov;mp3;mpg;odc;odf;odg;odi;odp;ods;odt;ogg;pdf;pgp;php;pl;png;ppt;ps;py;ram;rar;rb;rm;rpm;rtf;sig;sql;swf;sxc;sxd;sxi;sxw;tar;tex;tgz;txt;vcf;video;vsd;wav;wma;wmv;xls;xml;xpi;xvid;zip")
 #set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0))
 #set($filename = $doc.getFieldValue('resourcename'))
-#set($filetype = $mimeToExt.get($ct))
+
+#set($filetype = false)
+#set($filetype = $extMap.get($ct))
+##TODO: falling back to file extension is convenient, except when you don't have an icon for that extension
+##      example "application/vnd.openxmlformats-officedocument.wordprocessingml.document" document
+##        with a .docx extension.  It'd be nice to fall back to an "unknown" or the existing "file" type
+##      We sort of do this below, but only if the filename has no extension (anything after the last dot).
 #if(!$filetype)#set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1))#end
-#if(!$filetype)#set($filetype = "file")#end
-#if(!$supportedtypes.contains($filetype))#set($filetype = "file")#end
+##if(!$filetype)#set($filetype = "file")#end
+##if(!$supportedtypes.contains($filetype))#set($filetype = "file")#end
 <div class="result-title">
 ## Small file type icons from http://www.splitbrain.org/projects/file_icons (public domain)
 <img src="#{url_root}/img/filetypes/${filetype}.png" align="center">
@@ -29,7 +91,7 @@
 #if($ct) ($ct)#end
 </div>
 #if($doc.getFieldValue('author'))<div>Author: #field('author')</div>#end
-#if($doc.getFieldValue('last_modified'))<div>Last-modified: #field('last_modified')</div>#end
+#if($doc.getFieldValue('last_modified'))<div>last-modified: #field('last_modified')</div>#end
 <div class="result-body">#field('content')</div>
 <div class="mlt">
   #set($mlt = $mltResults.get($docId))

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/CharArr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/CharArr.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/CharArr.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/CharArr.java Tue Jan  8 03:40:16 2013
@@ -65,14 +65,17 @@ public class CharArr implements CharSequ
   public int getStart() { return start; }
   public int getEnd() { return end; }
   public int size() { return end-start; }
+  @Override
   public int length() { return size(); }
   public int capacity() { return buf.length; }
 
 
+  @Override
   public char charAt(int index) {
     return buf[start+index];
   }
 
+  @Override
   public CharArr subSequence(int start, int end) {
     return new CharArr(buf, this.start+start, this.start+end);
   }
@@ -157,6 +160,7 @@ public class CharArr implements CharSequ
   }
 
 
+  @Override
   public String toString() {
     return new String(buf, start, size());
   }
@@ -189,15 +193,18 @@ public class CharArr implements CharSequ
   }
 
   //////////////// Appendable methods /////////////
+  @Override
   public final Appendable append(CharSequence csq) throws IOException {
     return append(csq, 0, csq.length());
   }
 
+  @Override
   public Appendable append(CharSequence csq, int start, int end) throws IOException {
     write(csq.subSequence(start, end).toString());
     return null;
   }
 
+  @Override
   public final Appendable append(char c) {
     write(c);
     return this;
@@ -209,28 +216,38 @@ class NullCharArr extends CharArr {
   public NullCharArr() {
     super(new char[1],0,0);
   }
+  @Override
   public void unsafeWrite(char b) {}
 
+  @Override
   public void unsafeWrite(char b[], int off, int len) {}
 
+  @Override
   public void unsafeWrite(int b) {}
 
+  @Override
   public void write(char b) {}
 
+  @Override
   public void write(char b[], int off, int len) {}
 
+  @Override
   public void reserve(int num) {}
 
+  @Override
   protected void resize(int len) {}
 
+  @Override
   public Appendable append(CharSequence csq, int start, int end) throws IOException {
     return this;
   }
 
+  @Override
   public char charAt(int index) {
     return 0;
   }
 
+  @Override
   public void write(String s, int stringOffset, int len) {
   }
 }
@@ -246,11 +263,13 @@ class CharArrReader extends CharArr {
     this.in = in;
   }
 
+  @Override
   public int read() throws IOException {
     if (start>=end) fill();
     return start>=end ? -1 : buf[start++];
   }
 
+  @Override
   public int read(CharBuffer cb) throws IOException {
     // empty the buffer and then read direct
     int sz = size();
@@ -260,6 +279,7 @@ class CharArrReader extends CharArr {
     return sz>0 ? sz : -1;
   }
 
+  @Override
   public int fill() throws IOException {
     if (start>=end) {
       reset();

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/JSONParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/JSONParser.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/JSONParser.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/noggit/JSONParser.java Tue Jan  8 03:40:16 2013
@@ -624,6 +624,7 @@ public class JSONParser {
     }
   }
 
+  @Override
   public String toString() {
     return "start="+start+",end="+end+",state="+state+"valstate="+valstate;
   }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java Tue Jan  8 03:40:16 2013
@@ -67,27 +67,33 @@ public class BinaryRequestWriter extends
     new JavaBinUpdateRequestCodec().marshal(request, baos);
     
     return new ContentStream() {
+      @Override
       public String getName() {
         return null;
       }
 
+      @Override
       public String getSourceInfo() {
         return "javabin";
       }
 
+      @Override
       public String getContentType() {
         return "application/javabin";
       }
 
+      @Override
       public Long getSize() // size if we know it, otherwise null
       {
         return new Long(baos.size());
       }
 
+      @Override
       public InputStream getStream() {
         return new ByteArrayInputStream(baos.getbuf(), 0, baos.size());
       }
 
+      @Override
       public Reader getReader() {
         throw new RuntimeException("No reader available . this is a binarystream");
       }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java Tue Jan  8 03:40:16 2013
@@ -163,9 +163,10 @@ public class CloudSolrServer extends Sol
   }
 
   @Override
-  public NamedList<Object> request(SolrRequest request) throws SolrServerException, IOException {
+  public NamedList<Object> request(SolrRequest request)
+      throws SolrServerException, IOException {
     connect();
-
+    
     // TODO: if you can hash here, you could favor the shard leader
     
     ClusterState clusterState = zkStateReader.getClusterState();
@@ -176,95 +177,111 @@ public class CloudSolrServer extends Sol
       sendToLeaders = true;
       replicas = new ArrayList<String>();
     }
-
+    
     SolrParams reqParams = request.getParams();
     if (reqParams == null) {
       reqParams = new ModifiableSolrParams();
     }
-    String collection = reqParams.get("collection", defaultCollection);
-    
-    if (collection == null) {
-      throw new SolrServerException("No collection param specified on request and no default collection has been set.");
-    }
-    
-    // Extract each comma separated collection name and store in a List.
-    List<String> collectionList = StrUtils.splitSmart(collection, ",", true);
-    
-    // TODO: not a big deal because of the caching, but we could avoid looking at every shard
-    // when getting leaders if we tweaked some things
-    
-    // Retrieve slices from the cloud state and, for each collection specified,
-    // add it to the Map of slices.
-    Map<String,Slice> slices = new HashMap<String,Slice>();
-    for (String collectionName : collectionList) {
-      ClientUtils.addSlices(slices, collectionName, clusterState.getSlices(collectionName), true);
-    }
-
-    Set<String> liveNodes = clusterState.getLiveNodes();
-
-    List<String> theUrlList;
-    synchronized (cachLock) {
-      List<String> leaderUrlList = leaderUrlLists.get(collection);
-      List<String> urlList = urlLists.get(collection);
-      List<String> replicasList = replicasLists.get(collection);
-
-      if ((sendToLeaders && leaderUrlList == null) || (!sendToLeaders
-          && urlList == null)
-          || clusterState.hashCode() != this.lastClusterStateHashCode) {
-        // build a map of unique nodes
-        // TODO: allow filtering by group, role, etc
-        Map<String,ZkNodeProps> nodes = new HashMap<String,ZkNodeProps>();
-        List<String> urlList2 = new ArrayList<String>();
-        for (Slice slice : slices.values()) {
-          for (ZkNodeProps nodeProps : slice.getReplicasMap().values()) {
-            ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps(nodeProps);
-            String node = coreNodeProps.getNodeName();
-            if (!liveNodes.contains(coreNodeProps.getNodeName())
-                || !coreNodeProps.getState().equals(ZkStateReader.ACTIVE)) continue;
-            if (nodes.put(node, nodeProps) == null) {
-              if (!sendToLeaders || (sendToLeaders && coreNodeProps.isLeader())) {
-                String url = coreNodeProps.getCoreUrl();
-                urlList2.add(url);
-              } else if (sendToLeaders) {
-                String url = coreNodeProps.getCoreUrl();
-                replicas.add(url);
+    List<String> theUrlList = new ArrayList<String>();
+    if (request.getPath().equals("/admin/collections")) {
+      Set<String> liveNodes = clusterState.getLiveNodes();
+      for (String liveNode : liveNodes) {
+        int splitPointBetweenHostPortAndContext = liveNode.indexOf("_");
+        theUrlList.add("http://"
+            + liveNode.substring(0, splitPointBetweenHostPortAndContext) + "/"
+            + liveNode.substring(splitPointBetweenHostPortAndContext + 1));
+      }
+    } else {
+      String collection = reqParams.get("collection", defaultCollection);
+      
+      if (collection == null) {
+        throw new SolrServerException(
+            "No collection param specified on request and no default collection has been set.");
+      }
+      
+      // Extract each comma separated collection name and store in a List.
+      List<String> collectionList = StrUtils.splitSmart(collection, ",", true);
+      
+      // TODO: not a big deal because of the caching, but we could avoid looking
+      // at every shard
+      // when getting leaders if we tweaked some things
+      
+      // Retrieve slices from the cloud state and, for each collection
+      // specified,
+      // add it to the Map of slices.
+      Map<String,Slice> slices = new HashMap<String,Slice>();
+      for (String collectionName : collectionList) {
+        ClientUtils.addSlices(slices, collectionName,
+            clusterState.getSlices(collectionName), true);
+      }
+      Set<String> liveNodes = clusterState.getLiveNodes();
+      
+      synchronized (cachLock) {
+        List<String> leaderUrlList = leaderUrlLists.get(collection);
+        List<String> urlList = urlLists.get(collection);
+        List<String> replicasList = replicasLists.get(collection);
+        
+        if ((sendToLeaders && leaderUrlList == null)
+            || (!sendToLeaders && urlList == null)
+            || clusterState.hashCode() != this.lastClusterStateHashCode) {
+          // build a map of unique nodes
+          // TODO: allow filtering by group, role, etc
+          Map<String,ZkNodeProps> nodes = new HashMap<String,ZkNodeProps>();
+          List<String> urlList2 = new ArrayList<String>();
+          for (Slice slice : slices.values()) {
+            for (ZkNodeProps nodeProps : slice.getReplicasMap().values()) {
+              ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps(nodeProps);
+              String node = coreNodeProps.getNodeName();
+              if (!liveNodes.contains(coreNodeProps.getNodeName())
+                  || !coreNodeProps.getState().equals(ZkStateReader.ACTIVE)) continue;
+              if (nodes.put(node, nodeProps) == null) {
+                if (!sendToLeaders
+                    || (sendToLeaders && coreNodeProps.isLeader())) {
+                  String url = coreNodeProps.getCoreUrl();
+                  urlList2.add(url);
+                } else if (sendToLeaders) {
+                  String url = coreNodeProps.getCoreUrl();
+                  replicas.add(url);
+                }
               }
             }
           }
+          
+          if (sendToLeaders) {
+            this.leaderUrlLists.put(collection, urlList2);
+            leaderUrlList = urlList2;
+            this.replicasLists.put(collection, replicas);
+            replicasList = replicas;
+          } else {
+            this.urlLists.put(collection, urlList2);
+            urlList = urlList2;
+          }
+          this.lastClusterStateHashCode = clusterState.hashCode();
         }
+        
         if (sendToLeaders) {
-          this.leaderUrlLists.put(collection, urlList2);
-          leaderUrlList = urlList2;
-          this.replicasLists.put(collection, replicas);
-          replicasList = replicas;
+          theUrlList = new ArrayList<String>(leaderUrlList.size());
+          theUrlList.addAll(leaderUrlList);
         } else {
-          this.urlLists.put(collection, urlList2);
-          urlList = urlList2;
+          theUrlList = new ArrayList<String>(urlList.size());
+          theUrlList.addAll(urlList);
+        }
+        Collections.shuffle(theUrlList, rand);
+        if (sendToLeaders) {
+          ArrayList<String> theReplicas = new ArrayList<String>(
+              replicasList.size());
+          theReplicas.addAll(replicasList);
+          Collections.shuffle(theReplicas, rand);
+          // System.out.println("leaders:" + theUrlList);
+          // System.out.println("replicas:" + theReplicas);
+          theUrlList.addAll(theReplicas);
         }
-        this.lastClusterStateHashCode = clusterState.hashCode();
-      }
-      
-      if (sendToLeaders) {
-        theUrlList = new ArrayList<String>(leaderUrlList.size());
-        theUrlList.addAll(leaderUrlList);
-      } else {
-        theUrlList = new ArrayList<String>(urlList.size());
-        theUrlList.addAll(urlList);
-      }
-      Collections.shuffle(theUrlList, rand);
-      if (sendToLeaders) {
-        ArrayList<String> theReplicas = new ArrayList<String>(
-            replicasList.size());
-        theReplicas.addAll(replicasList);
-        Collections.shuffle(theReplicas, rand);
-        // System.out.println("leaders:" + theUrlList);
-        // System.out.println("replicas:" + theReplicas);
-        theUrlList.addAll(theReplicas);
       }
     }
- 
-   // System.out.println("########################## MAKING REQUEST TO " + theUrlList);
- 
+    
+    // System.out.println("########################## MAKING REQUEST TO " +
+    // theUrlList);
+    
     LBHttpSolrServer.Req req = new LBHttpSolrServer.Req(request, theUrlList);
     LBHttpSolrServer.Rsp rsp = lbServer.request(req);
     return rsp.getResponse();

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java Tue Jan  8 03:40:16 2013
@@ -114,6 +114,7 @@ public class ConcurrentUpdateSolrServer 
   class Runner implements Runnable {
     final Lock runnerLock = new ReentrantLock();
 
+    @Override
     public void run() {
       runnerLock.lock();
 
@@ -136,6 +137,7 @@ public class ConcurrentUpdateSolrServer 
 
             EntityTemplate template = new EntityTemplate(new ContentProducer() {
 
+              @Override
               public void writeTo(OutputStream out) throws IOException {
                 try {
                   if (isXml) {
@@ -243,6 +245,7 @@ public class ConcurrentUpdateSolrServer 
     }
   }
 
+  @Override
   public NamedList<Object> request(final SolrRequest request)
       throws SolrServerException, IOException {
     if (!(request instanceof UpdateRequest)) {
@@ -369,6 +372,18 @@ public class ConcurrentUpdateSolrServer 
       Thread.currentThread().interrupt();
     }
   }
+  
+  public void setConnectionTimeout(int timeout) {
+    HttpClientUtil.setConnectionTimeout(server.getHttpClient(), timeout);
+  }
+
+  /**
+   * set soTimeout (read timeout) on the underlying HttpConnectionManager. This is desirable for queries, but probably
+   * not for indexing.
+   */
+  public void setSoTimeout(int timeout) {
+    HttpClientUtil.setSoTimeout(server.getHttpClient(), timeout);
+  }
 
   public void shutdownNow() {
     server.shutdown();

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java Tue Jan  8 03:40:16 2013
@@ -238,6 +238,7 @@ public class HttpClientUtil {
   private static class UseCompressionResponseInterceptor implements
       HttpResponseInterceptor {
     
+    @Override
     public void process(final HttpResponse response, final HttpContext context)
         throws HttpException, IOException {
       
@@ -266,10 +267,12 @@ public class HttpClientUtil {
       super(entity);
     }
     
+    @Override
     public InputStream getContent() throws IOException, IllegalStateException {
       return new GZIPInputStream(wrappedEntity.getContent());
     }
     
+    @Override
     public long getContentLength() {
       return -1;
     }
@@ -281,6 +284,7 @@ public class HttpClientUtil {
       super(entity);
     }
     
+    @Override
     public InputStream getContent() throws IOException, IllegalStateException {
       return new InflaterInputStream(wrappedEntity.getContent());
     }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java Tue Jan  8 03:40:16 2013
@@ -563,16 +563,19 @@ public class HttpSolrServer extends Solr
     UpdateRequest req = new UpdateRequest();
     req.setDocIterator(new Iterator<SolrInputDocument>() {
       
+      @Override
       public boolean hasNext() {
         return beanIterator.hasNext();
       }
       
+      @Override
       public SolrInputDocument next() {
         Object o = beanIterator.next();
         if (o == null) return null;
         return getBinder().toSolrInputDocument(o);
       }
       
+      @Override
       public void remove() {
         beanIterator.remove();
       }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java Tue Jan  8 03:40:16 2013
@@ -85,7 +85,7 @@ public class LBHttpSolrServer extends So
   private final AtomicInteger counter = new AtomicInteger(-1);
 
   private static final SolrQuery solrQuery = new SolrQuery("*:*");
-  private static final BinaryResponseParser binaryParser = new BinaryResponseParser();
+  private final ResponseParser parser;
 
   static {
     solrQuery.setRows(0);
@@ -189,6 +189,7 @@ public class LBHttpSolrServer extends So
   public LBHttpSolrServer(HttpClient httpClient, ResponseParser parser, String... solrServerUrl)
           throws MalformedURLException {
     clientIsInternal = (httpClient == null);
+    this.parser = parser;
     if (httpClient == null) {
       ModifiableSolrParams params = new ModifiableSolrParams();
       params.set(HttpClientUtil.PROP_USE_RETRY, false);
@@ -210,7 +211,7 @@ public class LBHttpSolrServer extends So
   }
 
   protected HttpSolrServer makeServer(String server) throws MalformedURLException {
-    return new HttpSolrServer(server, httpClient, binaryParser);
+    return new HttpSolrServer(server, httpClient, parser);
   }
 
 
@@ -566,6 +567,7 @@ public class LBHttpSolrServer extends So
 
   private static Runnable getAliveCheckRunner(final WeakReference<LBHttpSolrServer> lbRef) {
     return new Runnable() {
+      @Override
       public void run() {
         LBHttpSolrServer lb = lbRef.get();
         if (lb != null && lb.zombieServers != null) {

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java Tue Jan  8 03:40:16 2013
@@ -50,6 +50,7 @@ public class CoreAdminRequest extends So
     protected String configName = null;
     protected String schemaName = null;
     protected String dataDir = null;
+    protected String ulogDir = null;
     protected String collection;
     private Integer numShards;
     private String shardId;
@@ -63,6 +64,7 @@ public class CoreAdminRequest extends So
     public void setSchemaName(String schema) { this.schemaName = schema; }
     public void setConfigName(String config) { this.configName = config; }
     public void setDataDir(String dataDir) { this.dataDir = dataDir; }
+    public void setUlogDir(String ulogDir) { this.ulogDir = ulogDir; }
     public void setCollection(String collection) { this.collection = collection; }
     public void setNumShards(int numShards) {this.numShards = numShards;}
     public void setShardId(String shardId) {this.shardId = shardId;}
@@ -72,6 +74,7 @@ public class CoreAdminRequest extends So
     public String getSchemaName()  { return schemaName; }
     public String getConfigName()  { return configName; }
     public String getDataDir() { return dataDir; }
+    public String getUlogDir() { return ulogDir; }
     public String getCollection() { return collection; }
     public String getShardId() { return shardId; }
     public String getRoles() { return roles; }
@@ -98,6 +101,9 @@ public class CoreAdminRequest extends So
       if (dataDir != null) {
         params.set( CoreAdminParams.DATA_DIR, dataDir);
       }
+      if (ulogDir != null) {
+        params.set( CoreAdminParams.ULOG_DIR, ulogDir);
+      }
       if (collection != null) {
         params.set( CoreAdminParams.COLLECTION, collection);
       }
@@ -471,11 +477,21 @@ public class CoreAdminRequest extends So
     return CoreAdminRequest.createCore(name, instanceDir, server, null, null);
   }
   
-  public static CoreAdminResponse createCore( String name, String instanceDir, SolrServer server, String configFile, String schemaFile ) throws SolrServerException, IOException 
+  public static CoreAdminResponse createCore( String name, String instanceDir, SolrServer server, String configFile, String schemaFile ) throws SolrServerException, IOException { 
+    return createCore(name, instanceDir, server, configFile, schemaFile, null, null);
+  }
+  
+  public static CoreAdminResponse createCore( String name, String instanceDir, SolrServer server, String configFile, String schemaFile, String dataDir, String tlogDir ) throws SolrServerException, IOException 
   {
     CoreAdminRequest.Create req = new CoreAdminRequest.Create();
     req.setCoreName( name );
     req.setInstanceDir(instanceDir);
+    if (dataDir != null) {
+      req.setDataDir(dataDir);
+    }
+    if (tlogDir != null) {
+      req.setUlogDir(tlogDir);
+    }
     if(configFile != null){
       req.setConfigName(configFile);
     }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java Tue Jan  8 03:40:16 2013
@@ -98,26 +98,32 @@ public class RequestWriter {
       return contentStream;
     }
 
+    @Override
     public String getName() {
       return getDelegate().getName();
     }
 
+    @Override
     public String getSourceInfo() {
       return getDelegate().getSourceInfo();
     }
 
+    @Override
     public String getContentType() {
       return getUpdateContentType();
     }
 
+    @Override
     public Long getSize() {
       return getDelegate().getSize();
     }
 
+    @Override
     public InputStream getStream() throws IOException {
       return getDelegate().getStream();
     }
 
+    @Override
     public Reader getReader() throws IOException {
       return getDelegate().getReader();
     }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/response/DocumentAnalysisResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/response/DocumentAnalysisResponse.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/response/DocumentAnalysisResponse.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/response/DocumentAnalysisResponse.java Tue Jan  8 03:40:16 2013
@@ -103,6 +103,7 @@ public class DocumentAnalysisResponse ex
    *
    * @return An iterator over the document analyses map.
    */
+  @Override
   public Iterator<Map.Entry<String, DocumentAnalysis>> iterator() {
     return documentAnalysisByKey.entrySet().iterator();
   }
@@ -152,6 +153,7 @@ public class DocumentAnalysisResponse ex
      *
      * @return An iterator over the field analyses map.
      */
+    @Override
     public Iterator<Map.Entry<String, FieldAnalysis>> iterator() {
       return fieldAnalysisByFieldName.entrySet().iterator();
     }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java Tue Jan  8 03:40:16 2013
@@ -23,8 +23,13 @@ import java.io.Writer;
 import java.net.URLEncoder;
 import java.text.DateFormat;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
 import java.util.Map.Entry;
+import java.util.TimeZone;
 import java.nio.ByteBuffer;
 
 import org.apache.solr.common.SolrDocument;
@@ -32,7 +37,11 @@ import org.apache.solr.common.SolrInputD
 import org.apache.solr.common.SolrInputField;
 import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.*;
+import org.apache.solr.common.util.Base64;
+import org.apache.solr.common.util.ContentStream;
+import org.apache.solr.common.util.ContentStreamBase;
+import org.apache.solr.common.util.DateUtil;
+import org.apache.solr.common.util.XML;
 
 
 /**
@@ -104,41 +113,57 @@ public class ClientUtils 
           // currently only supports a single value
           for (Entry<Object,Object> entry : ((Map<Object,Object>)v).entrySet()) {
             update = entry.getKey().toString();
-            Object fieldVal = entry.getValue();
-            v = fieldVal;
+            v = entry.getValue();
+            if (v instanceof Collection) {
+              Collection values = (Collection) v;
+              for (Object value : values) {
+                writeVal(writer, boost, name, value, update);
+                boost = 1.0f;
+              }
+            } else  {
+              writeVal(writer, boost, name, v, update);
+              boost = 1.0f;
+            }
           }
+        } else  {
+          writeVal(writer, boost, name, v, update);
+          // only write the boost for the first multi-valued field
+          // otherwise, the used boost is the product of all the boost values
+          boost = 1.0f;
         }
+      }
+    }
+    writer.write("</doc>");
+  }
 
-        if (v instanceof Date) {
-          v = DateUtil.getThreadLocalDateFormat().format( (Date)v );
-        } else if (v instanceof byte[]) {
-          byte[] bytes = (byte[]) v;
-          v = Base64.byteArrayToBase64(bytes, 0,bytes.length);
-        } else if (v instanceof ByteBuffer) {
-          ByteBuffer bytes = (ByteBuffer) v;
-          v = Base64.byteArrayToBase64(bytes.array(), bytes.position(),bytes.limit() - bytes.position());
-        }
+  private static void writeVal(Writer writer, float boost, String name, Object v, String update) throws IOException {
+    if (v instanceof Date) {
+      v = DateUtil.getThreadLocalDateFormat().format( (Date)v );
+    } else if (v instanceof byte[]) {
+      byte[] bytes = (byte[]) v;
+      v = Base64.byteArrayToBase64(bytes, 0, bytes.length);
+    } else if (v instanceof ByteBuffer) {
+      ByteBuffer bytes = (ByteBuffer) v;
+      v = Base64.byteArrayToBase64(bytes.array(), bytes.position(),bytes.limit() - bytes.position());
+    }
 
-        if (update == null) {
-          if( boost != 1.0f ) {
-            XML.writeXML(writer, "field", v.toString(), "name", name, "boost", boost );
-          } else if (v != null) {
-            XML.writeXML(writer, "field", v.toString(), "name", name );
-          }
-        } else {
-          if( boost != 1.0f ) {
-            XML.writeXML(writer, "field", v.toString(), "name", name, "boost", boost, "update", update);
-          } else if (v != null) {
-            XML.writeXML(writer, "field", v.toString(), "name", name, "update", update);
-          }
+    if (update == null) {
+      if( boost != 1.0f ) {
+        XML.writeXML(writer, "field", v.toString(), "name", name, "boost", boost);
+      } else if (v != null) {
+        XML.writeXML(writer, "field", v.toString(), "name", name );
+      }
+    } else {
+      if( boost != 1.0f ) {
+        XML.writeXML(writer, "field", v.toString(), "name", name, "boost", boost, "update", update);
+      } else {
+        if (v == null)  {
+          XML.writeXML(writer, "field", null, "name", name, "update", update, "null", true);
+        } else  {
+          XML.writeXML(writer, "field", v.toString(), "name", name, "update", update);
         }
-
-        // only write the boost for the first multi-valued field
-        // otherwise, the used boost is the product of all the boost values
-        boost = 1.0f;
       }
     }
-    writer.write("</doc>");
   }
 
 

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java Tue Jan  8 03:40:16 2013
@@ -64,6 +64,7 @@ public class SolrDocument implements Map
   /**
    * Remove all fields from the document
    */
+  @Override
   public void clear()
   {
     _fields.clear();
@@ -202,6 +203,7 @@ public class SolrDocument implements Map
   /**
    * Iterate of String->Object keys
    */
+  @Override
   public Iterator<Entry<String, Object>> iterator() {
     return _fields.entrySet().iterator();
   }
@@ -217,23 +219,35 @@ public class SolrDocument implements Map
   {
     return new Map<String,Collection<Object>>() {
       /** Get the field Value */
+      @Override
       public Collection<Object> get(Object key) { 
         return getFieldValues( (String)key ); 
       }
       
       // Easily Supported methods
+      @Override
       public boolean containsKey(Object key) { return _fields.containsKey( key ); }
+      @Override
       public Set<String>  keySet()           { return _fields.keySet();  }
+      @Override
       public int          size()             { return _fields.size();    }
+      @Override
       public boolean      isEmpty()          { return _fields.isEmpty(); }
 
       // Unsupported operations.  These are not necessary for JSTL
+      @Override
       public void clear() { throw new UnsupportedOperationException(); }
+      @Override
       public boolean containsValue(Object value) {throw new UnsupportedOperationException();}
+      @Override
       public Set<java.util.Map.Entry<String, Collection<Object>>> entrySet() {throw new UnsupportedOperationException();}
+      @Override
       public void putAll(Map<? extends String, ? extends Collection<Object>> t) {throw new UnsupportedOperationException();}
+      @Override
       public Collection<Collection<Object>> values() {throw new UnsupportedOperationException();}
+      @Override
       public Collection<Object> put(String key, Collection<Object> value) {throw new UnsupportedOperationException();}
+      @Override
       public Collection<Object> remove(Object key) {throw new UnsupportedOperationException();}
       @Override
       public String toString() {return _fields.toString();}
@@ -246,23 +260,35 @@ public class SolrDocument implements Map
   public Map<String,Object> getFieldValueMap() {
     return new Map<String,Object>() {
       /** Get the field Value */
+      @Override
       public Object get(Object key) { 
         return getFirstValue( (String)key ); 
       }
       
       // Easily Supported methods
+      @Override
       public boolean containsKey(Object key) { return _fields.containsKey( key ); }
+      @Override
       public Set<String>  keySet()           { return _fields.keySet();  }
+      @Override
       public int          size()             { return _fields.size();    }
+      @Override
       public boolean      isEmpty()          { return _fields.isEmpty(); }
 
       // Unsupported operations.  These are not necessary for JSTL
+      @Override
       public void clear() { throw new UnsupportedOperationException(); }
+      @Override
       public boolean containsValue(Object value) {throw new UnsupportedOperationException();}
+      @Override
       public Set<java.util.Map.Entry<String, Object>> entrySet() {throw new UnsupportedOperationException();}
+      @Override
       public void putAll(Map<? extends String, ? extends Object> t) {throw new UnsupportedOperationException();}
+      @Override
       public Collection<Object> values() {throw new UnsupportedOperationException();}
+      @Override
       public Collection<Object> put(String key, Object value) {throw new UnsupportedOperationException();}
+      @Override
       public Collection<Object> remove(Object key) {throw new UnsupportedOperationException();}      
       @Override
       public String toString() {return _fields.toString();}
@@ -273,46 +299,57 @@ public class SolrDocument implements Map
   // MAP interface
   //---------------------------------------------------
 
+  @Override
   public boolean containsKey(Object key) {
     return _fields.containsKey(key);
   }
 
+  @Override
   public boolean containsValue(Object value) {
     return _fields.containsValue(value);
   }
 
+  @Override
   public Set<Entry<String, Object>> entrySet() {
     return _fields.entrySet();
   }
   //TODO: Shouldn't the input parameter here be a String?  The _fields map requires a String.
+  @Override
   public Object get(Object key) {
     return _fields.get(key);
   }
 
+  @Override
   public boolean isEmpty() {
     return _fields.isEmpty();
   }
 
+  @Override
   public Set<String> keySet() {
     return _fields.keySet();
   }
 
+  @Override
   public Object put(String key, Object value) {
     return _fields.put(key, value);
   }
 
+  @Override
   public void putAll(Map<? extends String, ? extends Object> t) {
     _fields.putAll( t );
   }
 
+  @Override
   public Object remove(Object key) {
     return _fields.remove(key);
   }
 
+  @Override
   public int size() {
     return _fields.size();
   }
 
+  @Override
   public Collection<Object> values() {
     return _fields.values();
   }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java Tue Jan  8 03:40:16 2013
@@ -48,6 +48,7 @@ public class SolrInputDocument implement
   /**
    * Remove all fields and boosts from the document
    */
+  @Override
   public void clear()
   {
     if( _fields != null ) {
@@ -166,6 +167,7 @@ public class SolrInputDocument implement
     return _fields.get( field );
   }
 
+  @Override
   public Iterator<SolrInputField> iterator() {
     return _fields.values().iterator();
   }
@@ -198,46 +200,57 @@ public class SolrInputDocument implement
   // MAP interface
   //---------------------------------------------------
 
+  @Override
   public boolean containsKey(Object key) {
     return _fields.containsKey(key);
   }
 
+  @Override
   public boolean containsValue(Object value) {
     return _fields.containsValue(value);
   }
 
+  @Override
   public Set<Entry<String, SolrInputField>> entrySet() {
     return _fields.entrySet();
   }
 
+  @Override
   public SolrInputField get(Object key) {
     return _fields.get(key);
   }
 
+  @Override
   public boolean isEmpty() {
     return _fields.isEmpty();
   }
 
+  @Override
   public Set<String> keySet() {
     return _fields.keySet();
   }
 
+  @Override
   public SolrInputField put(String key, SolrInputField value) {
     return _fields.put(key, value);
   }
 
+  @Override
   public void putAll(Map<? extends String, ? extends SolrInputField> t) {
     _fields.putAll( t );
   }
 
+  @Override
   public SolrInputField remove(Object key) {
     return _fields.remove(key);
   }
 
+  @Override
   public int size() {
     return _fields.size();
   }
 
+  @Override
   public Collection<SolrInputField> values() {
     return _fields.values();
   }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java Tue Jan  8 03:40:16 2013
@@ -182,6 +182,7 @@ public class SolrInputField implements I
     this.name = name;
   }
 
+  @Override
   @SuppressWarnings("unchecked")
   public Iterator<Object> iterator() {
     if( value instanceof Collection ) {
@@ -190,15 +191,18 @@ public class SolrInputField implements I
     return new Iterator<Object>() {
       boolean nxt = (value!=null);
       
+      @Override
       public boolean hasNext() {
         return nxt;
       }
 
+      @Override
       public Object next() {
         nxt = false;
         return value;
       }
 
+      @Override
       public void remove() {
         throw new UnsupportedOperationException();
       }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java Tue Jan  8 03:40:16 2013
@@ -50,8 +50,6 @@ public class ClusterState implements JSO
   private final Map<String, DocCollection> collectionStates;  // Map<collectionName, Map<sliceName,Slice>>
   private final Set<String> liveNodes;
 
-  private final Map<String,RangeInfo> rangeInfos = new HashMap<String,RangeInfo>();
-  
   /**
    * Use this constr when ClusterState is meant for publication.
    * 
@@ -72,12 +70,11 @@ public class ClusterState implements JSO
     this.liveNodes.addAll(liveNodes);
     this.collectionStates = new HashMap<String, DocCollection>(collectionStates.size());
     this.collectionStates.putAll(collectionStates);
-    addRangeInfos(collectionStates.keySet());
   }
 
 
   /**
-   * Get properties of a shard/slice leader for specific collection, or null if one currently doesn't exist.
+   * Get the lead replica for specific collection, or null if one currently doesn't exist.
    */
   public Replica getLeader(String collection, String sliceName) {
     DocCollection coll = collectionStates.get(collection);
@@ -88,7 +85,7 @@ public class ClusterState implements JSO
   }
   
   /**
-   * Get replica properties (if the slice is unknown) or null if replica is not found.
+   * Gets the replica by the core name (assuming the slice is unknown) or null if replica is not found.
    * If the slice is known, do not use this method.
    * coreNodeName is the same as replicaName
    */
@@ -105,14 +102,9 @@ public class ClusterState implements JSO
     return null;
   }
 
-  private void addRangeInfos(Set<String> collections) {
-    for (String collection : collections) {
-      addRangeInfo(collection);
-    }
-  }
 
   /**
-   * Get the Slice for collection.
+   * Get the named Slice for collection, or null if not found.
    */
   public Slice getSlice(String collection, String sliceName) {
     DocCollection coll = collectionStates.get(collection);
@@ -184,34 +176,6 @@ public class ClusterState implements JSO
   public boolean liveNodesContain(String name) {
     return liveNodes.contains(name);
   }
-  
-  public RangeInfo getRanges(String collection) {
-    // TODO: store this in zk
-    RangeInfo rangeInfo = rangeInfos.get(collection);
-
-    return rangeInfo;
-  }
-
-  private RangeInfo addRangeInfo(String collection) {
-    List<Range> ranges;
-    RangeInfo rangeInfo;
-    rangeInfo = new RangeInfo();
-
-    DocCollection coll = getCollection(collection);
-    
-    Set<String> shards = coll.getSlicesMap().keySet();
-    ArrayList<String> shardList = new ArrayList<String>(shards.size());
-    shardList.addAll(shards);
-    Collections.sort(shardList);
-    
-    ranges = DocRouter.DEFAULT.partitionRange(shards.size(), Integer.MIN_VALUE, Integer.MAX_VALUE);
-    
-    rangeInfo.ranges = ranges;
-    rangeInfo.shardList = shardList;
-    rangeInfos.put(collection, rangeInfo);
-    return rangeInfo;
-  }
-
 
   @Override
   public String toString() {
@@ -261,10 +225,21 @@ public class ClusterState implements JSO
   }
 
   private static DocCollection collectionFromObjects(String name, Map<String,Object> objs) {
-    Map<String,Object> props = (Map<String,Object>)objs.get(DocCollection.PROPERTIES);
-    if (props == null) props = Collections.emptyMap();
+    Map<String,Object> props;
+    Map<String,Slice> slices;
+
+    Map<String,Object> sliceObjs = (Map<String,Object>)objs.get(DocCollection.SHARDS);
+    if (sliceObjs == null) {
+      // legacy format from 4.0... there was no separate "shards" level to contain the collection shards.
+      slices = makeSlices(objs);
+      props = Collections.emptyMap();
+    } else {
+      slices = makeSlices(sliceObjs);
+      props = new HashMap<String, Object>(objs);
+      objs.remove(DocCollection.SHARDS);
+    }
+
     DocRouter router = DocRouter.getDocRouter(props.get(DocCollection.DOC_ROUTER));
-    Map<String,Slice> slices = makeSlices(objs);
     return new DocCollection(name, slices, props, router);
   }
 
@@ -273,15 +248,12 @@ public class ClusterState implements JSO
     Map<String,Slice> result = new LinkedHashMap<String, Slice>(genericSlices.size());
     for (Map.Entry<String,Object> entry : genericSlices.entrySet()) {
       String name = entry.getKey();
-      if (DocCollection.PROPERTIES.equals(name)) continue;  // skip special properties entry
       Object val = entry.getValue();
-      Slice s;
       if (val instanceof Slice) {
-        s = (Slice)val;
-      } else {
-        s = new Slice(name, null, (Map<String,Object>)val);
+        result.put(name, (Slice)val);
+      } else if (val instanceof Map) {
+        result.put(name, new Slice(name, null, (Map<String,Object>)val));
       }
-      result.put(name, s);
     }
     return result;
   }
@@ -290,11 +262,6 @@ public class ClusterState implements JSO
   public void write(JSONWriter jsonWriter) {
     jsonWriter.write(collectionStates);
   }
-  
-  private class RangeInfo {
-    private List<Range> ranges;
-    private ArrayList<String> shardList;
-  }
 
   /**
    * The version of clusterstate.json in ZooKeeper.

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java Tue Jan  8 03:40:16 2013
@@ -141,4 +141,58 @@ public class CompositeIdRouter extends H
 
     return targetSlices;
   }
+
+
+  @Override
+  public List<Range> partitionRange(int partitions, Range range) {
+    int min = range.min;
+    int max = range.max;
+
+    assert max >= min;
+    if (partitions == 0) return Collections.EMPTY_LIST;
+    long rangeSize = (long)max - (long)min;
+    long rangeStep = Math.max(1, rangeSize / partitions);
+
+    List<Range> ranges = new ArrayList<Range>(partitions);
+
+    long start = min;
+    long end = start;
+
+    // keep track of the idealized target to avoid accumulating rounding errors
+    long targetStart = min;
+    long targetEnd = targetStart;
+
+    // Round to avoid splitting hash domains across ranges if such rounding is not significant.
+    // With default bits==16, one would need to create more than 4000 shards before this
+    // becomes false by default.
+    boolean round = rangeStep >= (1<<bits)*16;
+
+    while (end < max) {
+      targetEnd = targetStart + rangeStep;
+      end = targetEnd;
+
+      if (round && ((end & mask2) != mask2)) {
+        // round up or down?
+        int increment = 1 << bits;  // 0x00010000
+        long roundDown = (end | mask2) - increment ;
+        long roundUp = (end | mask2) + increment;
+        if (end - roundDown < roundUp - end && roundDown > start) {
+          end = roundDown;
+        } else {
+          end = roundUp;
+        }
+      }
+
+      // make last range always end exactly on MAX_VALUE
+      if (ranges.size() == partitions - 1) {
+        end = max;
+      }
+      ranges.add(new Range((int)start, (int)end));
+      start = end + 1L;
+      targetStart = targetEnd + 1L;
+    }
+
+    return ranges;
+  }
+
 }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java Tue Jan  8 03:40:16 2013
@@ -66,6 +66,7 @@ class ConnectionManager implements Watch
     connected = false;
   }
 
+  @Override
   public synchronized void process(WatchedEvent event) {
     if (log.isInfoEnabled()) {
       log.info("Watcher " + this + " name:" + name + " got event " + event

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java Tue Jan  8 03:40:16 2013
@@ -21,6 +21,7 @@ import org.apache.noggit.JSONUtil;
 import org.apache.noggit.JSONWriter;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -29,18 +30,24 @@ import java.util.Map;
  * Models a Collection in zookeeper (but that Java name is obviously taken, hence "DocCollection")
  */
 public class DocCollection extends ZkNodeProps {
-  public static final String PROPERTIES = "properties";
   public static final String DOC_ROUTER = "router";
+  public static final String SHARDS = "shards";
 
   private final String name;
   private final Map<String, Slice> slices;
   private final DocRouter router;
 
+  /**
+   * @param name  The name of the collection
+   * @param slices The logical shards of the collection.  This is used directly and a copy is not made.
+   * @param props  The properties of the slice.  This is used directly and a copy is not made.
+   */
   public DocCollection(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router) {
-    super(props == null ? new HashMap<String,Object>(1) : props);
+    super( props==null ? Collections.<String,Object>emptyMap() : props);
     this.name = name;
     this.slices = slices;
     this.router = router;
+
     assert name != null && slices != null;
   }
 
@@ -81,10 +88,9 @@ public class DocCollection extends ZkNod
 
   @Override
   public void write(JSONWriter jsonWriter) {
-    // write out the properties under "properties"
     LinkedHashMap<String,Object> all = new LinkedHashMap<String,Object>(slices.size()+1);
-    all.put(PROPERTIES, propMap);
-    all.putAll(slices);
+    all.putAll(propMap);
+    all.put(SHARDS, slices);
     jsonWriter.write(all);
   }
 }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java Tue Jan  8 03:40:16 2013
@@ -85,6 +85,7 @@ public abstract class DocRouter {
       return includes(other.min) || includes(other.max) || isSubsetOf(other);
     }
 
+    @Override
     public String toString() {
       return Integer.toHexString(min) + '-' + Integer.toHexString(max);
     }
@@ -123,18 +124,17 @@ public abstract class DocRouter {
     return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE);
   }
 
-  public List<Range> partitionRange(int partitions, Range range) {
-    return partitionRange(partitions, range.min, range.max);
-  }
-
   /**
    * Returns the range for each partition
    */
-  public List<Range> partitionRange(int partitions, int min, int max) {
+  public List<Range> partitionRange(int partitions, Range range) {
+    int min = range.min;
+    int max = range.max;
+
     assert max >= min;
     if (partitions == 0) return Collections.EMPTY_LIST;
-    long range = (long)max - (long)min;
-    long srange = Math.max(1, range / partitions);
+    long rangeSize = (long)max - (long)min;
+    long rangeStep = Math.max(1, rangeSize / partitions);
 
     List<Range> ranges = new ArrayList<Range>(partitions);
 
@@ -142,7 +142,7 @@ public abstract class DocRouter {
     long end = start;
 
     while (end < max) {
-      end = start + srange;
+      end = start + rangeStep;
       // make last range always end exactly on MAX_VALUE
       if (ranges.size() == partitions - 1) {
         end = max;

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java Tue Jan  8 03:40:16 2013
@@ -35,7 +35,7 @@ public class Slice extends ZkNodeProps {
 
   private final String name;
   private final DocRouter.Range range;
-  private final Integer replicationFactor;
+  private final Integer replicationFactor;      // FUTURE: optional per-slice override of the collection replicationFactor
   private final Map<String,Replica> replicas;
   private final Replica leader;
 

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java Tue Jan  8 03:40:16 2013
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.util.List;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicLong;
@@ -70,11 +71,16 @@ public class SolrZkClient {
 
   private volatile SolrZooKeeper keeper;
   
-  private ZkCmdExecutor zkCmdExecutor = new ZkCmdExecutor();
+  private ZkCmdExecutor zkCmdExecutor;
 
   private volatile boolean isClosed = false;
   private ZkClientConnectionStrategy zkClientConnectionStrategy;
+  private int zkClientTimeout;
   
+  public int getZkClientTimeout() {
+    return zkClientTimeout;
+  }
+
   public SolrZkClient(String zkServerAddress, int zkClientTimeout) {
     this(zkServerAddress, zkClientTimeout, new DefaultConnectionStrategy(), null);
   }
@@ -91,6 +97,9 @@ public class SolrZkClient {
   public SolrZkClient(String zkServerAddress, int zkClientTimeout,
       ZkClientConnectionStrategy strat, final OnReconnect onReconnect, int clientConnectTimeout) {
     this.zkClientConnectionStrategy = strat;
+    this.zkClientTimeout = zkClientTimeout;
+    // we must retry at least as long as the session timeout
+    zkCmdExecutor = new ZkCmdExecutor(zkClientTimeout);
     connManager = new ConnectionManager("ZooKeeperConnection Watcher:"
         + zkServerAddress, this, zkServerAddress, zkClientTimeout, strat, onReconnect);
     try {
@@ -461,6 +470,28 @@ public class SolrZkClient {
   }
 
   /**
+   * Returns the baseURL corrisponding to a given node's nodeName -- 
+   * NOTE: does not (currently) imply that the nodeName (or resulting 
+   * baseURL) exists in the cluster.
+   * @lucene.experimental
+   */
+  public String getBaseUrlForNodeName(final String nodeName) {
+    final int _offset = nodeName.indexOf("_");
+    if (_offset < 0) {
+      throw new IllegalArgumentException("nodeName does not contain expected '_' seperator: " + nodeName);
+    }
+    final String hostAndPort = nodeName.substring(0,_offset);
+    try {
+      final String path = URLDecoder.decode(nodeName.substring(1+_offset),
+                                            "UTF-8");
+      return "http://" + hostAndPort + (path.isEmpty() ? "" : ("/" + path));
+    } catch (UnsupportedEncodingException e) {
+      throw new IllegalStateException("JVM Does not seem to support UTF-8", e);
+    }
+  }
+
+
+  /**
    * Fills string with printout of current ZooKeeper layout.
    */
   public void printLayout(String path, int indent, StringBuilder string)

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java Tue Jan  8 03:40:16 2013
@@ -52,6 +52,7 @@ public class SolrZooKeeper extends ZooKe
    */
   public void pauseCnxn(final long ms) {
     final Thread t = new Thread() {
+      @Override
       public void run() {
         try {
           final ClientCnxn cnxn = getConnection();

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java Tue Jan  8 03:40:16 2013
@@ -27,11 +27,13 @@ import org.apache.zookeeper.data.ACL;
 
 
 public class ZkCmdExecutor {
-  private long retryDelay = 1000L;
-  private int retryCount = 15;
+  private long retryDelay = 1300L; // 300 ms over for padding
+  private int retryCount;
   private List<ACL> acl = ZooDefs.Ids.OPEN_ACL_UNSAFE;
   
-  public ZkCmdExecutor() {
+  public ZkCmdExecutor(int timeoutms) {
+    double timeouts = timeoutms / 1000.0;
+    this.retryCount = Math.round(0.5f * ((float)Math.sqrt(8.0f * timeouts + 1.0f) - 1.0f));
   }
   
   public List<ACL> getAcl() {

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java Tue Jan  8 03:40:16 2013
@@ -127,18 +127,21 @@ public class ZkStateReader {
   
   private boolean closeClient = false;
 
-  private ZkCmdExecutor cmdExecutor = new ZkCmdExecutor();
+  private ZkCmdExecutor cmdExecutor;
   
   public ZkStateReader(SolrZkClient zkClient) {
     this.zkClient = zkClient;
+    initZkCmdExecutor(zkClient.getZkClientTimeout());
   }
-  
+
   public ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout) throws InterruptedException, TimeoutException, IOException {
     closeClient = true;
+    initZkCmdExecutor(zkClientTimeout);
     zkClient = new SolrZkClient(zkServerAddress, zkClientTimeout, zkClientConnectTimeout,
         // on reconnect, reload cloud info
         new OnReconnect() {
 
+          @Override
           public void command() {
             try {
               ZkStateReader.this.createClusterStateWatchersAndUpdate();
@@ -158,6 +161,11 @@ public class ZkStateReader {
         });
   }
   
+  private void initZkCmdExecutor(int zkClientTimeout) {
+    // we must retry at least as long as the session timeout
+    cmdExecutor = new ZkCmdExecutor(zkClientTimeout);
+  }
+  
   // load and publish a new CollectionInfo
   public void updateClusterState(boolean immediate) throws KeeperException, InterruptedException {
     updateClusterState(immediate, false);
@@ -317,6 +325,7 @@ public class ZkStateReader {
       clusterStateUpdateScheduled = true;
       updateCloudExecutor.schedule(new Runnable() {
         
+        @Override
         public void run() {
           log.info("Updating cluster state from ZooKeeper...");
           synchronized (getUpdateLock()) {
@@ -391,7 +400,7 @@ public class ZkStateReader {
   
   public String getLeaderUrl(String collection, String shard, int timeout)
       throws InterruptedException, KeeperException {
-    ZkCoreNodeProps props = new ZkCoreNodeProps(getLeaderProps(collection,
+    ZkCoreNodeProps props = new ZkCoreNodeProps(getLeaderRetry(collection,
         shard, timeout));
     return props.getCoreUrl();
   }
@@ -399,14 +408,14 @@ public class ZkStateReader {
   /**
    * Get shard leader properties, with retry if none exist.
    */
-  public Replica getLeaderProps(String collection, String shard) throws InterruptedException {
-    return getLeaderProps(collection, shard, 1000);
+  public Replica getLeaderRetry(String collection, String shard) throws InterruptedException {
+    return getLeaderRetry(collection, shard, 1000);
   }
 
   /**
    * Get shard leader properties, with retry if none exist.
    */
-  public Replica getLeaderProps(String collection, String shard, int timeout) throws InterruptedException {
+  public Replica getLeaderRetry(String collection, String shard, int timeout) throws InterruptedException {
     long timeoutAt = System.currentTimeMillis() + timeout;
     while (System.currentTimeMillis() < timeoutAt) {
       if (clusterState != null) {    

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java Tue Jan  8 03:40:16 2013
@@ -36,6 +36,8 @@ public interface CoreAdminParams 
 
   /** If you rename something, what is the new name **/
   public final static String DATA_DIR = "dataDir";
+  
+  public final static String ULOG_DIR = "ulogDir";
 
   /** Name of the other core in actions involving 2 cores **/
   public final static String OTHER = "other";

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java Tue Jan  8 03:40:16 2013
@@ -186,6 +186,7 @@ public abstract class ContentStreamBase 
    * Base reader implementation.  If the contentType declares a 
    * charset use it, otherwise use "utf-8".
    */
+  @Override
   public Reader getReader() throws IOException {
     String charset = getCharsetFromContentType( getContentType() );
     return charset == null 
@@ -197,6 +198,7 @@ public abstract class ContentStreamBase 
   // Getters / Setters for overrideable attributes
   //------------------------------------------------------------------
 
+  @Override
   public String getContentType() {
     return contentType;
   }
@@ -205,6 +207,7 @@ public abstract class ContentStreamBase 
     this.contentType = contentType;
   }
 
+  @Override
   public String getName() {
     return name;
   }
@@ -213,6 +216,7 @@ public abstract class ContentStreamBase 
     this.name = name;
   }
 
+  @Override
   public Long getSize() {
     return size;
   }
@@ -221,6 +225,7 @@ public abstract class ContentStreamBase 
     this.size = size;
   }
 
+  @Override
   public String getSourceInfo() {
     return sourceInfo;
   }

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java Tue Jan  8 03:40:16 2013
@@ -51,7 +51,7 @@ public class ExecutorUtil {
     while (!shutdown) {
       try {
         // Wait a while for existing tasks to terminate
-        shutdown = pool.awaitTermination(60, TimeUnit.SECONDS);
+        shutdown = pool.awaitTermination(30, TimeUnit.SECONDS);
       } catch (InterruptedException ie) {
         // Preserve interrupt status
         Thread.currentThread().interrupt();

Modified: lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/FastInputStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/FastInputStream.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/FastInputStream.java (original)
+++ lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/util/FastInputStream.java Tue Jan  8 03:40:16 2013
@@ -65,6 +65,7 @@ public class FastInputStream extends Inp
   }
 
 
+  @Override
   public int readUnsignedByte() throws IOException {
     if (pos >= end) {
       refill();
@@ -140,10 +141,12 @@ public class FastInputStream extends Inp
     in.close();
   }
 
+  @Override
   public void readFully(byte b[]) throws IOException {
     readFully(b, 0, b.length);
   }
 
+  @Override
   public void readFully(byte b[], int off, int len) throws IOException {
     while (len>0) {
       int ret = read(b, off, len);
@@ -155,6 +158,7 @@ public class FastInputStream extends Inp
     }
   }
 
+  @Override
   public int skipBytes(int n) throws IOException {
     if (end-pos >= n) {
       pos += n;
@@ -177,10 +181,12 @@ public class FastInputStream extends Inp
     return r;
   }
 
+  @Override
   public boolean readBoolean() throws IOException {
     return readByte()==1;
   }
 
+  @Override
   public byte readByte() throws IOException {
     if (pos >= end) {
       refill();
@@ -190,18 +196,22 @@ public class FastInputStream extends Inp
   }
 
 
+  @Override
   public short readShort() throws IOException {
     return (short)((readUnsignedByte() << 8) | readUnsignedByte());
   }
 
+  @Override
   public int readUnsignedShort() throws IOException {
     return (readUnsignedByte() << 8) | readUnsignedByte();
   }
 
+  @Override
   public char readChar() throws IOException {
     return (char)((readUnsignedByte() << 8) | readUnsignedByte());
   }
 
+  @Override
   public int readInt() throws IOException {
     return  ((readUnsignedByte() << 24)
             |(readUnsignedByte() << 16)
@@ -209,6 +219,7 @@ public class FastInputStream extends Inp
             | readUnsignedByte());
   }
 
+  @Override
   public long readLong() throws IOException {
     return  (((long)readUnsignedByte()) << 56)
             | (((long)readUnsignedByte()) << 48)
@@ -220,18 +231,22 @@ public class FastInputStream extends Inp
             | (readUnsignedByte());
   }
 
+  @Override
   public float readFloat() throws IOException {
     return Float.intBitsToFloat(readInt());    
   }
 
+  @Override
   public double readDouble() throws IOException {
     return Double.longBitsToDouble(readLong());    
   }
 
+  @Override
   public String readLine() throws IOException {
     throw new UnsupportedOperationException();
   }
 
+  @Override
   public String readUTF() throws IOException {
     return new DataInputStream(this).readUTF();
   }



Mime
View raw message