You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/02/09 00:53:25 UTC
svn commit: r1658277 [35/38] - in /lucene/dev/branches/lucene6005: ./
dev-tools/ dev-tools/idea/solr/contrib/dataimporthandler/
dev-tools/idea/solr/contrib/velocity/ dev-tools/maven/lucene/replicator/
dev-tools/maven/solr/ dev-tools/maven/solr/contrib/...
Modified: lucene/dev/branches/lucene6005/solr/licenses/start.jar.sha1
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/licenses/start.jar.sha1?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/licenses/start.jar.sha1 (original)
+++ lucene/dev/branches/lucene6005/solr/licenses/start.jar.sha1 Sun Feb 8 23:53:14 2015
@@ -1 +1 @@
-8e1a37a8daae3f222d957012f826047497466a56
+6380e0fe5a738cced80ef705dbac3320a8f25edf
Modified: lucene/dev/branches/lucene6005/solr/licenses/tika-core-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/licenses/tika-core-NOTICE.txt?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/licenses/tika-core-NOTICE.txt (original)
+++ lucene/dev/branches/lucene6005/solr/licenses/tika-core-NOTICE.txt Sun Feb 8 23:53:14 2015
@@ -1,12 +1,9 @@
Apache Tika
-Copyright 2011 The Apache Software Foundation
+Copyright 2015 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
-Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata
-This software contains code derived from UCAR/Unidata's NetCDF library.
-
Tika-server compoment uses CDDL-licensed dependencies: jersey (http://jersey.java.net/) and
Grizzly (http://grizzly.java.net/)
Modified: lucene/dev/branches/lucene6005/solr/licenses/tika-parsers-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/licenses/tika-parsers-NOTICE.txt?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/licenses/tika-parsers-NOTICE.txt (original)
+++ lucene/dev/branches/lucene6005/solr/licenses/tika-parsers-NOTICE.txt Sun Feb 8 23:53:14 2015
@@ -1,12 +1,9 @@
Apache Tika parsers
-Copyright 2011 The Apache Software Foundation
+Copyright 2015 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
-Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata
-This software contains code derived from UCAR/Unidata's NetCDF library.
-
Tika-server compoment uses CDDL-licensed dependencies: jersey (http://jersey.java.net/) and
Grizzly (http://grizzly.java.net/)
Modified: lucene/dev/branches/lucene6005/solr/licenses/tika-xmp-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/licenses/tika-xmp-NOTICE.txt?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/licenses/tika-xmp-NOTICE.txt (original)
+++ lucene/dev/branches/lucene6005/solr/licenses/tika-xmp-NOTICE.txt Sun Feb 8 23:53:14 2015
@@ -1,12 +1,9 @@
Apache Tika xmp
-Copyright 2011 The Apache Software Foundation
+Copyright 2015 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
-Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata
-This software contains code derived from UCAR/Unidata's NetCDF library.
-
Tika-server compoment uses CDDL-licensed dependencies: jersey (http://jersey.java.net/) and
Grizzly (http://grizzly.java.net/)
Modified: lucene/dev/branches/lucene6005/solr/server/contexts/solr-jetty-context.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/contexts/solr-jetty-context.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/contexts/solr-jetty-context.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/contexts/solr-jetty-context.xml Sun Feb 8 23:53:14 2015
@@ -1,8 +1,9 @@
<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
- <Set name="contextPath"><SystemProperty name="hostContext" default="/solr"/></Set>
- <Set name="war"><SystemProperty name="jetty.home"/>/webapps/solr.war</Set>
- <Set name="defaultsDescriptor"><SystemProperty name="jetty.home"/>/etc/webdefault.xml</Set>
- <Set name="tempDirectory"><Property name="jetty.home" default="."/>/solr-webapp</Set>
+ <Set name="contextPath"><Property name="hostContext" default="/solr"/></Set>
+ <Set name="war"><Property name="jetty.base"/>/webapps/solr.war</Set>
+ <Set name="defaultsDescriptor"><Property name="jetty.base"/>/etc/webdefault.xml</Set>
+ <Set name="tempDirectory"><Property name="jetty.base" default="."/>/solr-webapp</Set>
+ <Set name="persistTempDirectory">true</Set>
</Configure>
Modified: lucene/dev/branches/lucene6005/solr/server/etc/jetty.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/etc/jetty.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/etc/jetty.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/etc/jetty.xml Sun Feb 8 23:53:14 2015
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Server -->
@@ -13,91 +13,6 @@
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
- <!-- Server Thread Pool -->
- <!-- =========================================================== -->
- <Set name="ThreadPool">
- <!-- Default queued blocking threadpool -->
- <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
- <Set name="minThreads">10</Set>
- <Set name="maxThreads">10000</Set>
- <Set name="detailedDump">false</Set>
- </New>
- </Set>
-
- <!-- =========================================================== -->
- <!-- Set connectors -->
- <!-- =========================================================== -->
-
- <!--
- <Call name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
- <Set name="host"><SystemProperty name="jetty.host" /></Set>
- <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
- <Set name="maxIdleTime">50000</Set>
- <Set name="Acceptors">2</Set>
- <Set name="statsOn">false</Set>
- <Set name="confidentialPort">8443</Set>
- <Set name="lowResourcesConnections">5000</Set>
- <Set name="lowResourcesMaxIdleTime">5000</Set>
- </New>
- </Arg>
- </Call>
- -->
-
- <!-- This connector is currently being used for Solr because it
- showed better performance than nio.SelectChannelConnector
- for typical Solr requests. -->
- <Call name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.bio.SocketConnector">
- <Set name="host"><SystemProperty name="jetty.host" /></Set>
- <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
- <Set name="maxIdleTime">50000</Set>
- <Set name="lowResourceMaxIdleTime">1500</Set>
- <Set name="statsOn">false</Set>
- </New>
- </Arg>
- </Call>
-
- <!-- if the connector below is uncommented, then jetty will also accept SSL
- connections on port 8984, using a self signed certificate and can
- optionally require the client to authenticate with a certificate.
- (which can be the same as the server certificate_
-
- # Run solr example with SSL on port 8984
- java -jar start.jar
- #
- # Run post.jar so that it trusts the server cert...
- java -Djavax.net.ssl.trustStore=../etc/solrtest.keystore -Durl=https://localhost:8984/solr/update -jar post.jar *.xml
-
- # Run solr example with SSL requiring client certs on port 8984
- java -Djetty.ssl.clientAuth=true -jar start.jar
- #
- # Run post.jar so that it trusts the server cert,
- # and authenticates with a client cert
- java -Djavax.net.ssl.keyStorePassword=secret -Djavax.net.ssl.keyStore=../etc/solrtest.keystore -Djavax.net.ssl.trustStore=../etc/solrtest.keystore -Durl=https://localhost:8984/solr/update -jar post.jar *.xml
-
- -->
- <!--
- <Call name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
- <Arg>
- <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
- <Set name="keyStore"><SystemProperty name="jetty.home" default="."/>/etc/solrtest.keystore</Set>
- <Set name="keyStorePassword">secret</Set>
- <Set name="needClientAuth"><SystemProperty name="jetty.ssl.clientAuth" default="false"/></Set>
- </New>
- </Arg>
- <Set name="port"><SystemProperty name="jetty.ssl.port" default="8984"/></Set>
- <Set name="maxIdleTime">30000</Set>
- </New>
- </Arg>
- </Call>
- -->
-
- <!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
@@ -121,7 +36,7 @@
<!-- =========================================================== -->
<!-- Configure Request Log -->
<!-- =========================================================== -->
- <!--
+ <!--
<Ref id="Handlers">
<Call name="addHandler">
<Arg>
@@ -149,26 +64,28 @@
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
- <Set name="sendServerVersion">false</Set>
- <Set name="sendDateHeader">false</Set>
- <Set name="gracefulShutdown">1000</Set>
<Set name="dumpAfterStart">false</Set>
<Set name="dumpBeforeStop">false</Set>
-
-
-
<Call name="addBean">
<Arg>
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
<Set name="contexts">
- <Ref id="Contexts" />
+ <Ref refid="Contexts" />
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/servlet-api-[^/]*\.jar$</Arg>
</Call>
-
+
+ <Call name="addAppProvider">
+ <Arg>
+ <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
+ <Set name="monitoredDirName"><Property name="jetty.home" default="."/>/contexts</Set>
+ <Set name="scanInterval">0</Set>
+ </New>
+ </Arg>
+ </Call>
<!-- Add a customize step to the deployment lifecycle -->
<!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
@@ -190,15 +107,4 @@
</Arg>
</Call>
- <Ref id="DeploymentManager">
- <Call name="addAppProvider">
- <Arg>
- <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
- <Set name="monitoredDirName"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
- <Set name="scanInterval">0</Set>
- </New>
- </Arg>
- </Call>
- </Ref>
-
</Configure>
Modified: lucene/dev/branches/lucene6005/solr/server/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/ivy.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/ivy.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/ivy.xml Sun Feb 8 23:53:14 2015
@@ -17,7 +17,7 @@
under the License.
-->
<ivy-module version="2.0">
- <info organisation="org.apache.solr" module="example"/>
+ <info organisation="org.apache.solr" module="server"/>
<configurations defaultconfmapping="jetty->master;start->master;servlet->master;logging->master">
<conf name="jetty" description="jetty jars" transitive="false"/>
<conf name="start" description="jetty start jar" transitive="false"/>
@@ -40,15 +40,15 @@
<dependency org="org.eclipse.jetty" name="jetty-security" rev="${/org.eclipse.jetty/jetty-security}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-server" rev="${/org.eclipse.jetty/jetty-server}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-servlet" rev="${/org.eclipse.jetty/jetty-servlet}" conf="jetty"/>
+ <dependency org="org.eclipse.jetty" name="jetty-servlets" rev="${/org.eclipse.jetty/jetty-servlets}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-util" rev="${/org.eclipse.jetty/jetty-util}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-webapp" rev="${/org.eclipse.jetty/jetty-webapp}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-xml" rev="${/org.eclipse.jetty/jetty-xml}" conf="jetty"/>
+ <dependency org="javax.servlet" name="javax.servlet-api" rev="${/javax.servlet/javax.servlet-api}" conf="jetty"/>
+
<dependency org="org.eclipse.jetty" name="jetty-start" rev="${/org.eclipse.jetty/jetty-start}" conf="start"/>
- <dependency org="org.eclipse.jetty.orbit" name="javax.servlet" rev="${/org.eclipse.jetty.orbit/javax.servlet}" conf="servlet">
- <artifact name="javax.servlet" type="orbit" ext="jar"/>
- </dependency>
<exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/>
</dependencies>
Modified: lucene/dev/branches/lucene6005/solr/server/solr/configsets/basic_configs/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/solr/configsets/basic_configs/conf/schema.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/solr/configsets/basic_configs/conf/schema.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/solr/configsets/basic_configs/conf/schema.xml Sun Feb 8 23:53:14 2015
@@ -504,13 +504,13 @@
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
-->
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
- geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" />
+ geo="true" distErrPct="0.025" maxDistErr="0.001" distanceUnits="kilometers" />
<!-- Spatial rectangle (bounding box) field. It supports most spatial predicates, and has
special relevancy modes: score=overlapRatio|area|area2D (local-param to the query). DocValues is recommended for
relevancy. -->
<fieldType name="bbox" class="solr.BBoxField"
- geo="true" units="degrees" numberType="_bbox_coord" />
+ geo="true" distanceUnits="kilometers" numberType="_bbox_coord" />
<fieldType name="_bbox_coord" class="solr.TrieDoubleField" precisionStep="8" docValues="true" stored="false"/>
<!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType
Modified: lucene/dev/branches/lucene6005/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml Sun Feb 8 23:53:14 2015
@@ -256,15 +256,6 @@
<unlockOnStartup>false</unlockOnStartup>
-->
- <!-- If true, IndexReaders will be opened/reopened from the IndexWriter
- instead of from the Directory. Hosts in a master/slave setup
- should have this set to false while those in a SolrCloud
- cluster need to be set to true. Default: true
- -->
- <!--
- <nrtMode>true</nrtMode>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
@@ -869,24 +860,9 @@
(SearchHandler) can be registered multiple times with different
names (and different init parameters)
-->
- <requestHandler name="/browse" class="solr.SearchHandler">
+ <requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,velocity,browse">
<lst name="defaults">
<str name="echoParams">explicit</str>
-
- <!-- VelocityResponseWriter settings -->
- <str name="wt">velocity</str>
- <str name="v.template">browse</str>
- <str name="v.layout">layout</str>
-
- <!-- Query settings -->
- <str name="defType">edismax</str>
- <str name="q.alt">*:*</str>
- <str name="rows">10</str>
- <str name="fl">*,score</str>
-
- <!-- Faceting defaults -->
- <str name="facet">on</str>
- <str name="facet.mincount">1</str>
</lst>
</requestHandler>
@@ -1402,6 +1378,10 @@
<processor class="solr.LogUpdateProcessorFactory"/>
<processor class="solr.DistributedUpdateProcessorFactory"/>
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory"/>
+ <processor class="solr.FieldNameMutatingUpdateProcessorFactory">
+ <str name="pattern">[^\w-\.]</str>
+ <str name="replacement">_</str>
+ </processor>
<processor class="solr.ParseBooleanFieldUpdateProcessorFactory"/>
<processor class="solr.ParseLongFieldUpdateProcessorFactory"/>
<processor class="solr.ParseDoubleFieldUpdateProcessorFactory"/>
@@ -1550,8 +1530,9 @@
<!--
Custom response writers can be declared as needed...
-->
- <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy"/>
-
+ <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
+ <str name="template.base.dir">${velocity.template.base.dir:}</str>
+ </queryResponseWriter>
<!-- XSLT response writer transforms the XML output by any xslt file found
in Solr's conf/xslt directory. Changes to xslt files are checked for
Modified: lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml Sun Feb 8 23:53:14 2015
@@ -707,13 +707,13 @@
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
-->
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
- geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" />
+ geo="true" distErrPct="0.025" maxDistErr="0.001" distanceUnits="kilometers" />
<!-- Spatial rectangle (bounding box) field. It supports most spatial predicates, and has
special relevancy modes: score=overlapRatio|area|area2D (local-param to the query). DocValues is recommended for
relevancy. -->
<fieldType name="bbox" class="solr.BBoxField"
- geo="true" units="degrees" numberType="_bbox_coord" />
+ geo="true" distanceUnits="kilometers" numberType="_bbox_coord" />
<fieldType name="_bbox_coord" class="solr.TrieDoubleField" precisionStep="8" docValues="true" stored="false"/>
<!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType
Modified: lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml Sun Feb 8 23:53:14 2015
@@ -117,23 +117,7 @@
persistent, and doesn't work with replication.
-->
<directoryFactory name="DirectoryFactory"
- class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}">
-
-
- <!-- These will be used if you are using the solr.HdfsDirectoryFactory,
- otherwise they will be ignored. If you don't plan on using hdfs,
- you can safely remove this section. -->
- <!-- The root directory that collection data should be written to. -->
- <str name="solr.hdfs.home">${solr.hdfs.home:}</str>
- <!-- The hadoop configuration files to use for the hdfs client. -->
- <str name="solr.hdfs.confdir">${solr.hdfs.confdir:}</str>
- <!-- Enable/Disable the hdfs cache. -->
- <str name="solr.hdfs.blockcache.enabled">${solr.hdfs.blockcache.enabled:true}</str>
- <!-- Enable/Disable using one global cache for all SolrCores.
- The settings used will be from the first HdfsDirectoryFactory created. -->
- <str name="solr.hdfs.blockcache.global">${solr.hdfs.blockcache.global:true}</str>
-
- </directoryFactory>
+ class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
<!-- The CodecFactory for defining the format of the inverted index.
The default implementation is SchemaCodecFactory, which is the official Lucene
@@ -274,15 +258,6 @@
<unlockOnStartup>false</unlockOnStartup>
-->
- <!-- If true, IndexReaders will be opened/reopened from the IndexWriter
- instead of from the Directory. Hosts in a master/slave setup
- should have this set to false while those in a SolrCloud
- cluster need to be set to true. Default: true
- -->
- <!--
- <nrtMode>true</nrtMode>
- -->
-
<!-- Commit Deletion Policy
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
@@ -1364,8 +1339,7 @@
To use this suggester, set the "solr.suggester.enabled=true" system property
-->
- <searchComponent name="suggest" class="solr.SuggestComponent"
- enable="${solr.suggester.enabled:false}" >
+ <searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
@@ -1373,11 +1347,12 @@
<str name="field">cat</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">string</str>
+ <str name="buildOnStartup">false</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler"
- startup="lazy" enable="${solr.suggester.enabled:false}" >
+ startup="lazy" >
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
@@ -1771,7 +1746,9 @@
<!--
Custom response writers can be declared as needed...
-->
- <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy"/>
+ <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
+ <str name="template.base.dir">${velocity.template.base.dir:}</str>
+ </queryResponseWriter>
<!-- XSLT response writer transforms the XML output by any xslt file found
Modified: lucene/dev/branches/lucene6005/solr/server/solr/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/server/solr/solr.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/server/solr/solr.xml (original)
+++ lucene/dev/branches/lucene6005/solr/server/solr/solr.xml Sun Feb 8 23:53:14 2015
@@ -29,17 +29,23 @@
<solr>
<solrcloud>
+
<str name="host">${host:}</str>
<int name="hostPort">${jetty.port:8983}</int>
<str name="hostContext">${hostContext:solr}</str>
- <int name="zkClientTimeout">${zkClientTimeout:30000}</int>
+
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
+
+ <int name="zkClientTimeout">${zkClientTimeout:30000}</int>
+ <int name="distribUpdateSoTimeout">${distribUpdateSoTimeout:600000}</int>
+ <int name="distribUpdateConnTimeout">${distribUpdateConnTimeout:60000}</int>
+
</solrcloud>
<shardHandlerFactory name="shardHandlerFactory"
class="HttpShardHandlerFactory">
- <int name="socketTimeout">${socketTimeout:0}</int>
- <int name="connTimeout">${connTimeout:0}</int>
+ <int name="socketTimeout">${socketTimeout:600000}</int>
+ <int name="connTimeout">${connTimeout:60000}</int>
</shardHandlerFactory>
</solr>
Modified: lucene/dev/branches/lucene6005/solr/solrj/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/ivy.xml?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/ivy.xml (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/ivy.xml Sun Feb 8 23:53:14 2015
@@ -32,7 +32,8 @@
<dependency org="org.apache.httpcomponents" name="httpmime" rev="${/org.apache.httpcomponents/httpmime}" conf="compile"/>
<dependency org="org.apache.httpcomponents" name="httpcore" rev="${/org.apache.httpcomponents/httpcore}" conf="compile"/>
<dependency org="commons-io" name="commons-io" rev="${/commons-io/commons-io}" conf="compile"/>
- <dependency org="org.codehaus.woodstox" name="wstx-asl" rev="${/org.codehaus.woodstox/wstx-asl}" conf="compile"/>
+ <dependency org="org.codehaus.woodstox" name="woodstox-core-asl" rev="${/org.codehaus.woodstox/woodstox-core-asl}" conf="compile"/>
+ <dependency org="org.codehaus.woodstox" name="stax2-api" rev="${/org.codehaus.woodstox/stax2-api}" conf="compile"/>
<dependency org="org.noggit" name="noggit" rev="${/org.noggit/noggit}" conf="compile"/>
<dependency org="org.slf4j" name="slf4j-api" rev="${/org.slf4j/slf4j-api}" conf="compile"/>
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java Sun Feb 8 23:53:14 2015
@@ -26,13 +26,20 @@ import org.apache.solr.client.solrj.requ
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.SolrPingResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.StringUtils;
+import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
+import java.io.Closeable;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -41,7 +48,7 @@ import java.util.List;
*
* @since 5.0, replaced {@code SolrServer}
*/
-public abstract class SolrClient implements Serializable {
+public abstract class SolrClient implements Serializable, Closeable {
private static final long serialVersionUID = 1L;
private DocumentObjectBinder binder;
@@ -332,6 +339,56 @@ public abstract class SolrClient impleme
}
/**
+ * Retrieves the SolrDocument associated with the given identifier.
+ *
+ * @return retrieved SolrDocument, null if no document is found.
+ */
+ public SolrDocument getById(String id) throws SolrServerException {
+ return getById(id, null);
+ }
+
+ /**
+ * Retrieves the SolrDocument associated with the given identifier and uses
+ * the SolrParams to execute the request.
+ *
+ * @return retrieved SolrDocument, null if no document is found.
+ */
+ public SolrDocument getById(String id, SolrParams params) throws SolrServerException {
+ SolrDocumentList docs = getById(Arrays.asList(id), params);
+ if (!docs.isEmpty()) {
+ return docs.get(0);
+ }
+ return null;
+ }
+
+ /**
+ * Retrieves the SolrDocuments associated with the given identifiers.
+ * If a document was not found, it will not be added to the SolrDocumentList.
+ */
+ public SolrDocumentList getById(Collection<String> ids) throws SolrServerException {
+ return getById(ids, null);
+ }
+
+ /**
+ * Retrieves the SolrDocuments associated with the given identifiers and uses
+ * the SolrParams to execute the request.
+ * If a document was not found, it will not be added to the SolrDocumentList.
+ */
+ public SolrDocumentList getById(Collection<String> ids, SolrParams params) throws SolrServerException {
+ if (ids == null || ids.isEmpty()) {
+ throw new IllegalArgumentException("Must provide an identifier of a document to retrieve.");
+ }
+
+ ModifiableSolrParams reqParams = new ModifiableSolrParams(params);
+ if (StringUtils.isEmpty(reqParams.get(CommonParams.QT))) {
+ reqParams.set(CommonParams.QT, "/get");
+ }
+ reqParams.set("ids", (String[]) ids.toArray());
+
+ return query(reqParams).getResults();
+ }
+
+ /**
* SolrServer implementations need to implement how a request is actually processed
*/
public abstract NamedList<Object> request(final SolrRequest request) throws SolrServerException, IOException;
@@ -343,10 +400,4 @@ public abstract class SolrClient impleme
return binder;
}
- /**
- * Release allocated resources.
- *
- * @since solr 4.0
- */
- public abstract void shutdown();
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java Sun Feb 8 23:53:14 2015
@@ -17,13 +17,6 @@
package org.apache.solr.client.solrj;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.regex.Pattern;
-
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.FacetParams;
import org.apache.solr.common.params.HighlightParams;
@@ -32,6 +25,13 @@ import org.apache.solr.common.params.Sta
import org.apache.solr.common.params.TermsParams;
import org.apache.solr.common.util.DateUtil;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.regex.Pattern;
+
/**
* This is an augmented SolrParams with get/set/add fields for common fields used
@@ -443,14 +443,6 @@ public class SolrQuery extends Modifiabl
return this;
}
- /**
- * @deprecated use {@link #setFacetMissing(Boolean)}
- */
- @Deprecated
- public SolrQuery setMissing(String fld) {
- return setFacetMissing(Boolean.valueOf(fld));
- }
-
/** get facet sort
*
* @return facet sort or default of {@link FacetParams#FACET_SORT_COUNT}
@@ -459,18 +451,6 @@ public class SolrQuery extends Modifiabl
return this.get(FacetParams.FACET_SORT, FacetParams.FACET_SORT_COUNT);
}
- /** get facet sort
- *
- * @return facet sort or default of true. <br />
- * true corresponds to
- * {@link FacetParams#FACET_SORT_COUNT} and <br />false to {@link FacetParams#FACET_SORT_INDEX}
- *
- * @deprecated Use {@link #getFacetSortString()} instead.
- */
- @Deprecated
- public boolean getFacetSort() {
- return this.get(FacetParams.FACET_SORT, FacetParams.FACET_SORT_COUNT).equals(FacetParams.FACET_SORT_COUNT);
- }
/** set facet sort
*
@@ -482,19 +462,6 @@ public class SolrQuery extends Modifiabl
return this;
}
- /** set facet sort
- *
- * @param sort sort facets
- * @return this
- * @deprecated Use {@link #setFacetSort(String)} instead, true corresponds to
- * {@link FacetParams#FACET_SORT_COUNT} and false to {@link FacetParams#FACET_SORT_INDEX}.
- */
- @Deprecated
- public SolrQuery setFacetSort(boolean sort) {
- this.set(FacetParams.FACET_SORT, sort == true ? FacetParams.FACET_SORT_COUNT : FacetParams.FACET_SORT_INDEX);
- return this;
- }
-
/** add highlight field
*
* @param f field to enable for highlighting
@@ -572,57 +539,6 @@ public class SolrQuery extends Modifiabl
}
/**
- * Replaces the sort string with a single sort field.
- * @deprecated Use {@link #setSort(SortClause)} instead, which is part
- * of an api handling a wider range of sort specifications.
- */
- @Deprecated
- public SolrQuery setSortField(String field, ORDER order) {
- this.remove(CommonParams.SORT);
- addValueToParam(CommonParams.SORT, toSortString(field, order));
- return this;
- }
-
- /**
- * Adds a sort field to the end of the sort string.
- * @deprecated Use {@link #addSort(SortClause)} instead, which is part
- * of an api handling a wider range of sort specifications.
- */
- @Deprecated
- public SolrQuery addSortField(String field, ORDER order) {
- return addValueToParam(CommonParams.SORT, toSortString(field, order));
- }
-
- /**
- * Removes a sort field to the end of the sort string.
- * @deprecated Use {@link #removeSort(SortClause)} instead, which is part
- * of an api handling a wider range of sort specifications.
- */
- @Deprecated
- public SolrQuery removeSortField(String field, ORDER order) {
- String[] sorts = getSortFields();
- if (sorts != null) {
- String removeSort = toSortString(field, order);
- String s = join(sorts, ",", removeSort);
- if (s.length()==0) s=null;
- this.set(CommonParams.SORT, s);
- }
- return this;
- }
-
- /**
- * Gets an array of sort specifications.
- * @deprecated Use {@link #getSorts()} instead, which is part
- * of an api handling a wider range of sort specifications.
- */
- @Deprecated
- public String[] getSortFields() {
- String s = getSortField();
- if (s==null) return null;
- return s.trim().split(", *");
- }
-
- /**
* Gets the raw sort field, as it will be sent to Solr.
* <p>
* The returned sort field will always contain a serialized version
@@ -979,22 +895,6 @@ public class SolrQuery extends Modifiabl
}
/**
- * @deprecated See {@link #setRequestHandler(String)}.
- */
- @Deprecated
- public SolrQuery setQueryType(String qt) {
- return setRequestHandler(qt);
- }
-
- /**
- * @deprecated See {@link #getRequestHandler()}.
- */
- @Deprecated
- public String getQueryType() {
- return getRequestHandler();
- }
-
- /**
* @return this
* @see ModifiableSolrParams#set(String,String[])
*/
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java Sun Feb 8 23:53:14 2015
@@ -46,6 +46,7 @@ import org.apache.solr.common.params.Mod
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.params.UpdateParams;
+import org.apache.solr.common.util.Hash;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SolrjNamedThreadFactory;
import org.apache.solr.common.util.StrUtils;
@@ -126,9 +127,10 @@ public class CloudSolrClient extends Sol
}
private volatile long timeToLive = 60* 1000L;
+ private volatile List<Object> locks = objectList(3);
- protected Map<String, ExpiringCachedDocCollection> collectionStateCache = new ConcurrentHashMap<String, ExpiringCachedDocCollection>(){
+ protected final Map<String, ExpiringCachedDocCollection> collectionStateCache = new ConcurrentHashMap<String, ExpiringCachedDocCollection>(){
@Override
public ExpiringCachedDocCollection get(Object key) {
ExpiringCachedDocCollection val = super.get(key);
@@ -143,7 +145,7 @@ public class CloudSolrClient extends Sol
};
class ExpiringCachedDocCollection {
- DocCollection cached;
+ final DocCollection cached;
long cachedAt;
ExpiringCachedDocCollection(DocCollection cached) {
@@ -458,15 +460,7 @@ public class CloudSolrClient extends Sol
Thread.currentThread().interrupt();
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
"", e);
- } catch (KeeperException e) {
- if (zk != null) zk.close();
- throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
- "", e);
- } catch (IOException e) {
- if (zk != null) zk.close();
- throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
- "", e);
- } catch (TimeoutException e) {
+ } catch (KeeperException | TimeoutException | IOException e) {
if (zk != null) zk.close();
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
"", e);
@@ -753,7 +747,7 @@ public class CloudSolrClient extends Sol
String stateVerParam = null;
List<DocCollection> requestedCollections = null;
if (collection != null && !request.getPath().startsWith("/admin")) { // don't do _stateVer_ checking for admin requests
- Set<String> requestedCollectionNames = getCollectionList(getZkStateReader().getClusterState(), collection);
+ Set<String> requestedCollectionNames = getCollectionNames(getZkStateReader().getClusterState(), collection);
StringBuilder stateVerParamBuilder = null;
for (String requestedCollection : requestedCollectionNames) {
@@ -916,16 +910,13 @@ public class CloudSolrClient extends Sol
"No collection param specified on request and no default collection has been set.");
}
- Set<String> collectionsList = getCollectionList(clusterState, collection);
- if (collectionsList.size() == 0) {
+ Set<String> collectionNames = getCollectionNames(clusterState, collection);
+ if (collectionNames.size() == 0) {
throw new SolrException(ErrorCode.BAD_REQUEST,
"Could not find collection: " + collection);
}
String shardKeys = reqParams.get(ShardParams._ROUTE_);
- if(shardKeys == null) {
- shardKeys = reqParams.get(ShardParams.SHARD_KEYS); // deprecated
- }
// TODO: not a big deal because of the caching, but we could avoid looking
// at every shard
@@ -935,7 +926,7 @@ public class CloudSolrClient extends Sol
// specified,
// add it to the Map of slices.
Map<String,Slice> slices = new HashMap<>();
- for (String collectionName : collectionsList) {
+ for (String collectionName : collectionNames) {
DocCollection col = getDocCollection(clusterState, collectionName);
Collection<Slice> routeSlices = col.getRouter().getSearchSlices(shardKeys, reqParams , col);
ClientUtils.addSlices(slices, collectionName, routeSlices, true);
@@ -997,6 +988,9 @@ public class CloudSolrClient extends Sol
theUrlList.addAll(urlList);
}
if(theUrlList.isEmpty()) {
+ for (String s : collectionNames) {
+ if(s!=null) collectionStateCache.remove(s);
+ }
throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "Not enough nodes to handle the request");
}
@@ -1016,11 +1010,11 @@ public class CloudSolrClient extends Sol
return rsp.getResponse();
}
- private Set<String> getCollectionList(ClusterState clusterState,
- String collection) {
+ private Set<String> getCollectionNames(ClusterState clusterState,
+ String collection) {
// Extract each comma separated collection name and store in a List.
List<String> rawCollectionsList = StrUtils.splitSmart(collection, ",", true);
- Set<String> collectionsList = new HashSet<>();
+ Set<String> collectionNames = new HashSet<>();
// validate collections
for (String collectionName : rawCollectionsList) {
if (!clusterState.getCollections().contains(collectionName)) {
@@ -1028,20 +1022,20 @@ public class CloudSolrClient extends Sol
String alias = aliases.getCollectionAlias(collectionName);
if (alias != null) {
List<String> aliasList = StrUtils.splitSmart(alias, ",", true);
- collectionsList.addAll(aliasList);
+ collectionNames.addAll(aliasList);
continue;
}
throw new SolrException(ErrorCode.BAD_REQUEST, "Collection not found: " + collectionName);
}
- collectionsList.add(collectionName);
+ collectionNames.add(collectionName);
}
- return collectionsList;
+ return collectionNames;
}
@Override
- public void shutdown() {
+ public void close() throws IOException {
if (zkStateReader != null) {
synchronized(this) {
if (zkStateReader!= null)
@@ -1051,11 +1045,11 @@ public class CloudSolrClient extends Sol
}
if (shutdownLBHttpSolrServer) {
- lbClient.shutdown();
+ lbClient.close();
}
if (clientIsInternal && myClient!=null) {
- myClient.getConnectionManager().shutdown();
+ HttpClientUtil.close(myClient);
}
if(this.threadPool != null && !this.threadPool.isShutdown()) {
@@ -1071,18 +1065,50 @@ public class CloudSolrClient extends Sol
return updatesToLeaders;
}
+ /**If caches are expired they are refreshed after acquiring a lock.
+ * use this to set the number of locks
+ */
+ public void setParallelCacheRefreshes(int n){ locks = objectList(n); }
+
+ private static ArrayList<Object> objectList(int n) {
+ ArrayList<Object> l = new ArrayList<>(n);
+ for(int i=0;i<n;i++) l.add(new Object());
+ return l;
+ }
+
+
protected DocCollection getDocCollection(ClusterState clusterState, String collection) throws SolrException {
- ExpiringCachedDocCollection cachedState = collectionStateCache != null ? collectionStateCache.get(collection) : null;
- if (cachedState != null && cachedState.cached != null) {
- return cachedState.cached;
+ if(collection == null) return null;
+ DocCollection col = getFromCache(collection);
+ if(col != null) return col;
+
+ ClusterState.CollectionRef ref = clusterState.getCollectionRef(collection);
+ if(ref == null){
+ //no such collection exists
+ return null;
+ }
+ if(!ref.isLazilyLoaded()) {
+ //it is readily available just return it
+ return ref.get();
+ }
+ List locks = this.locks;
+ final Object lock = locks.get(Math.abs(Hash.murmurhash3_x86_32(collection, 0, collection.length(), 0) % locks.size()));
+ synchronized (lock){
+ //we have waited for sometime just check once again
+ col = getFromCache(collection);
+ if(col !=null) return col;
+ col = ref.get();
}
-
- DocCollection col = clusterState.getCollectionOrNull(collection);
if(col == null ) return null;
if(col.getStateFormat() >1) collectionStateCache.put(collection, new ExpiringCachedDocCollection(col));
return col;
}
+ private DocCollection getFromCache(String c){
+ ExpiringCachedDocCollection cachedState = collectionStateCache.get(c);
+ return cachedState != null ? cachedState.cached : null;
+ }
+
/**
* Useful for determining the minimum achieved replication factor across
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java Sun Feb 8 23:53:14 2015
@@ -36,6 +36,7 @@ import org.apache.solr.common.params.Com
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.params.UpdateParams;
+import org.apache.solr.common.util.IOUtils;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SolrjNamedThreadFactory;
import org.slf4j.Logger;
@@ -424,8 +425,8 @@ public class ConcurrentUpdateSolrClient
}
@Override
- public void shutdown() {
- client.shutdown();
+ public void close() {
+ IOUtils.closeQuietly(client);
if (shutdownExecutor) {
scheduler.shutdown();
try {
@@ -454,7 +455,7 @@ public class ConcurrentUpdateSolrClient
}
public void shutdownNow() {
- client.shutdown();
+ IOUtils.closeQuietly(client);
if (shutdownExecutor) {
scheduler.shutdownNow(); // Cancel currently executing tasks
try {
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientConfigurer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientConfigurer.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientConfigurer.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientConfigurer.java Sun Feb 8 23:53:14 2015
@@ -29,7 +29,7 @@ import org.apache.solr.common.params.Sol
*/
public class HttpClientConfigurer {
- protected void configure(DefaultHttpClient httpClient, SolrParams config) {
+ public void configure(DefaultHttpClient httpClient, SolrParams config) {
if (config.get(HttpClientUtil.PROP_MAX_CONNECTIONS) != null) {
HttpClientUtil.setMaxConnections(httpClient,
@@ -51,16 +51,15 @@ public class HttpClientConfigurer {
config.getInt(HttpClientUtil.PROP_SO_TIMEOUT));
}
- if (config.get(HttpClientUtil.PROP_USE_RETRY) != null) {
- HttpClientUtil.setUseRetry(httpClient,
- config.getBool(HttpClientUtil.PROP_USE_RETRY));
- }
-
if (config.get(HttpClientUtil.PROP_FOLLOW_REDIRECTS) != null) {
HttpClientUtil.setFollowRedirects(httpClient,
config.getBool(HttpClientUtil.PROP_FOLLOW_REDIRECTS));
}
+ // always call setUseRetry, whether it is in config or not
+ HttpClientUtil.setUseRetry(httpClient,
+ config.getBool(HttpClientUtil.PROP_USE_RETRY, true));
+
final String basicAuthUser = config
.get(HttpClientUtil.PROP_BASIC_AUTH_USER);
final String basicAuthPass = config
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java Sun Feb 8 23:53:14 2015
@@ -38,6 +38,7 @@ import org.apache.http.conn.scheme.Schem
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.conn.ssl.X509HostnameVerifier;
import org.apache.http.entity.HttpEntityWrapper;
+import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.client.SystemDefaultHttpClient;
@@ -54,7 +55,6 @@ import org.slf4j.LoggerFactory;
* Utility class for creating/configuring httpclient instances.
*/
public class HttpClientUtil {
-
// socket timeout measured in ms, closes a socket if read
// takes longer than x ms to complete. throws
// java.net.SocketTimeoutException: Read timed out exception
@@ -109,7 +109,7 @@ public class HttpClientUtil {
* http client configuration, if null a client with default
* configuration (no additional configuration) is created.
*/
- public static HttpClient createClient(final SolrParams params) {
+ public static CloseableHttpClient createClient(final SolrParams params) {
final ModifiableSolrParams config = new ModifiableSolrParams(params);
if (logger.isDebugEnabled()) {
logger.debug("Creating new http client, config:" + config);
@@ -123,7 +123,7 @@ public class HttpClientUtil {
* Creates new http client by using the provided configuration.
*
*/
- public static HttpClient createClient(final SolrParams params, ClientConnectionManager cm) {
+ public static CloseableHttpClient createClient(final SolrParams params, ClientConnectionManager cm) {
final ModifiableSolrParams config = new ModifiableSolrParams(params);
if (logger.isDebugEnabled()) {
logger.debug("Creating new http client, config:" + config);
@@ -141,6 +141,14 @@ public class HttpClientUtil {
SolrParams config) {
configurer.configure(httpClient, config);
}
+
+ public static void close(HttpClient httpClient) {
+ if (httpClient instanceof CloseableHttpClient) {
+ org.apache.solr.common.util.IOUtils.closeQuietly((CloseableHttpClient) httpClient);
+ } else {
+ httpClient.getConnectionManager().shutdown();
+ }
+ }
/**
* Control HTTP payload compression.
@@ -233,7 +241,14 @@ public class HttpClientUtil {
if (!useRetry) {
httpClient.setHttpRequestRetryHandler(NO_RETRY);
} else {
- httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler());
+ // if the request is not fully sent, we retry
+ // streaming updates are not a problem, because they are not retryable
+ httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(){
+ @Override
+ protected boolean handleAsIdempotent(final HttpRequest request) {
+ return false; // we can't tell if a Solr request is idempotent
+ }
+ });
}
}
@@ -269,6 +284,14 @@ public class HttpClientUtil {
}
}
+ public static void setStaleCheckingEnabled(final HttpClient httpClient, boolean enabled) {
+ HttpConnectionParams.setStaleCheckingEnabled(httpClient.getParams(), enabled);
+ }
+
+ public static void setTcpNoDelay(final HttpClient httpClient, boolean tcpNoDelay) {
+ HttpConnectionParams.setTcpNoDelay(httpClient.getParams(), tcpNoDelay);
+ }
+
private static class UseCompressionRequestInterceptor implements
HttpRequestInterceptor {
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java Sun Feb 8 23:53:14 2015
@@ -752,9 +752,9 @@ public class HttpSolrClient extends Solr
* Close the {@link ClientConnectionManager} from the internal client.
*/
@Override
- public void shutdown() {
+ public void close() throws IOException {
if (httpClient != null && internalClient) {
- httpClient.getConnectionManager().shutdown();
+ HttpClientUtil.close(httpClient);
}
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java Sun Feb 8 23:53:14 2015
@@ -21,7 +21,9 @@ import org.apache.solr.client.solrj.*;
import org.apache.solr.client.solrj.request.IsUpdateRequest;
import org.apache.solr.client.solrj.request.RequestWriter;
import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SolrjNamedThreadFactory;
import org.apache.solr.common.SolrException;
@@ -221,7 +223,12 @@ public class LBHttpSolrClient extends So
this.parser = parser;
if (httpClient == null) {
ModifiableSolrParams params = new ModifiableSolrParams();
- params.set(HttpClientUtil.PROP_USE_RETRY, false);
+ if (solrServerUrl.length > 1) {
+ // we prefer retrying another server
+ params.set(HttpClientUtil.PROP_USE_RETRY, false);
+ } else {
+ params.set(HttpClientUtil.PROP_USE_RETRY, true);
+ }
this.httpClient = HttpClientUtil.createClient(params);
} else {
this.httpClient = httpClient;
@@ -288,7 +295,13 @@ public class LBHttpSolrClient extends So
boolean isUpdate = req.request instanceof IsUpdateRequest;
List<ServerWrapper> skipped = null;
+ long timeAllowedNano = getTimeAllowedInNanos(req.getRequest());
+ long timeOutTime = System.nanoTime() + timeAllowedNano;
for (String serverStr : req.getServers()) {
+ if(isTimeExceeded(timeAllowedNano, timeOutTime)) {
+ break;
+ }
+
serverStr = normalize(serverStr);
// if the server is currently a zombie, just skip to the next one
ServerWrapper wrapper = zombieServers.get(serverStr);
@@ -318,6 +331,10 @@ public class LBHttpSolrClient extends So
// try the servers we previously skipped
if (skipped != null) {
for (ServerWrapper wrapper : skipped) {
+ if(isTimeExceeded(timeAllowedNano, timeOutTime)) {
+ break;
+ }
+
ex = doRequest(wrapper.client, req, rsp, isUpdate, true, wrapper.getKey());
if (ex == null) {
return rsp; // SUCCESS
@@ -452,12 +469,12 @@ public class LBHttpSolrClient extends So
}
@Override
- public void shutdown() {
+ public void close() {
if (aliveCheckExecutor != null) {
aliveCheckExecutor.shutdownNow();
}
if(clientIsInternal) {
- httpClient.getConnectionManager().shutdown();
+ HttpClientUtil.close(httpClient);
}
}
@@ -482,7 +499,13 @@ public class LBHttpSolrClient extends So
int maxTries = serverList.length;
Map<String,ServerWrapper> justFailed = null;
+ long timeAllowedNano = getTimeAllowedInNanos(request);
+ long timeOutTime = System.nanoTime() + timeAllowedNano;
for (int attempts=0; attempts<maxTries; attempts++) {
+ if(isTimeExceeded(timeAllowedNano, timeOutTime)) {
+ break;
+ }
+
int count = counter.incrementAndGet() & Integer.MAX_VALUE;
ServerWrapper wrapper = serverList[count % serverList.length];
wrapper.lastUsed = System.currentTimeMillis();
@@ -506,9 +529,12 @@ public class LBHttpSolrClient extends So
}
}
-
// try other standard servers that we didn't try just now
for (ServerWrapper wrapper : zombieServers.values()) {
+ if(isTimeExceeded(timeAllowedNano, timeOutTime)) {
+ break;
+ }
+
if (wrapper.standard==false || justFailed!=null && justFailed.containsKey(wrapper.getKey())) continue;
try {
NamedList<Object> rsp = wrapper.client.request(request);
@@ -540,6 +566,19 @@ public class LBHttpSolrClient extends So
}
/**
+ * @return time allowed in nanos, returns -1 if no time_allowed is specified.
+ */
+ private long getTimeAllowedInNanos(final SolrRequest req) {
+ SolrParams reqParams = req.getParams();
+ return reqParams == null ? -1 :
+ TimeUnit.NANOSECONDS.convert(reqParams.getInt(CommonParams.TIME_ALLOWED, -1), TimeUnit.MILLISECONDS);
+ }
+
+ private boolean isTimeExceeded(long timeAllowedNano, long timeOutTime) {
+ return timeAllowedNano > 0 && System.nanoTime() > timeOutTime;
+ }
+
+ /**
* Takes up one dead server and check for aliveness. The check is done in a roundrobin. Each server is checked for
* aliveness once in 'x' millis where x is decided by the setAliveCheckinterval() or it is defaulted to 1 minute
*
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java Sun Feb 8 23:53:14 2015
@@ -815,6 +815,10 @@ public class CollectionAdminRequest exte
private Boolean onlyActiveNodes;
private Boolean shardUnique;
+ public BalanceShardUnique() {
+ this.action = CollectionAction.BALANCESHARDUNIQUE;
+ }
+
public String getPropertyName() {
return propertyName;
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java Sun Feb 8 23:53:14 2015
@@ -587,14 +587,6 @@ public class CoreAdminRequest extends So
return req.process( client );
}
- @Deprecated
- public static CoreAdminResponse persist(String fileName, SolrClient client) throws SolrServerException, IOException
- {
- CoreAdminRequest.Persist req = new CoreAdminRequest.Persist();
- req.setFileName(fileName);
- return req.process(client);
- }
-
public static CoreAdminResponse mergeIndexes(String name,
String[] indexDirs, String[] srcCores, SolrClient client) throws SolrServerException,
IOException {
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java Sun Feb 8 23:53:14 2015
@@ -92,10 +92,8 @@ public class QueryRequest extends SolrRe
long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
res.setElapsedTime(endTime - startTime);
return res;
- } catch (SolrServerException e){
+ } catch (SolrServerException | SolrException e){
throw e;
- } catch (SolrException s){
- throw s;
} catch (Exception e) {
throw new SolrServerException("Error executing query", e);
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java Sun Feb 8 23:53:14 2015
@@ -208,7 +208,16 @@ public class UpdateRequest extends Abstr
routes.put(leaderUrl, request);
}
UpdateRequest urequest = (UpdateRequest) request.getRequest();
- urequest.add(doc);
+ Map<String,Object> value = entry.getValue();
+ Boolean ow = null;
+ if (value != null) {
+ ow = (Boolean) value.get(OVERWRITE);
+ }
+ if (ow != null) {
+ urequest.add(doc, ow);
+ } else {
+ urequest.add(doc);
+ }
}
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/RangeFacet.java Sun Feb 8 23:53:14 2015
@@ -84,11 +84,6 @@ public abstract class RangeFacet<B, G> {
public static class Numeric extends RangeFacet<Number, Number> {
- @Deprecated
- public Numeric(String name, Number start, Number end, Number gap, Number before, Number after) {
- this(name, start, end, gap, before, after, null);
- }
-
public Numeric(String name, Number start, Number end, Number gap, Number before, Number after, Number between) {
super(name, start, end, gap, before, after, between);
}
@@ -97,11 +92,6 @@ public abstract class RangeFacet<B, G> {
public static class Date extends RangeFacet<java.util.Date, String> {
- @Deprecated
- public Date(String name, java.util.Date start, java.util.Date end, String gap, Number before, Number after) {
- this(name, start, end, gap, before, after, null);
- }
-
public Date(String name, java.util.Date start, java.util.Date end, String gap, Number before, Number after, Number between) {
super(name, start, end, gap, before, after, between);
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java Sun Feb 8 23:53:14 2015
@@ -210,18 +210,6 @@ public class SpellCheckResponse {
return alternativeFrequencies;
}
- @Deprecated
- /** @see #getAlternatives */
- public List<String> getSuggestions() {
- return alternatives;
- }
-
- @Deprecated
- /** @see #getAlternativeFrequencies */
- public List<Integer> getSuggestionFrequencies() {
- return alternativeFrequencies;
- }
-
}
public class Collation {
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java Sun Feb 8 23:53:14 2015
@@ -17,21 +17,6 @@
package org.apache.solr.client.solrj.util;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URLEncoder;
-import java.text.DateFormat;
-import java.text.ParseException;
-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;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
@@ -43,6 +28,18 @@ import org.apache.solr.common.util.Conte
import org.apache.solr.common.util.DateUtil;
import org.apache.solr.common.util.XML;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URLEncoder;
+import java.nio.ByteBuffer;
+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;
+
/**
*
@@ -187,44 +184,6 @@ public class ClientUtils
//---------------------------------------------------------------------------------------
/**
- * @deprecated Use {@link org.apache.solr.common.util.DateUtil#DEFAULT_DATE_FORMATS}
- */
- @Deprecated
- public static final Collection<String> fmts = DateUtil.DEFAULT_DATE_FORMATS;
-
- /**
- * Returns a formatter that can be use by the current thread if needed to
- * convert Date objects to the Internal representation.
- *
- * @deprecated Use {@link org.apache.solr.common.util.DateUtil#parseDate(String)}
- */
- @Deprecated
- public static Date parseDate( String d ) throws ParseException
- {
- return DateUtil.parseDate(d);
- }
-
- /**
- * Returns a formatter that can be use by the current thread if needed to
- * convert Date objects to the Internal representation.
- *
- * @deprecated use {@link org.apache.solr.common.util.DateUtil#getThreadLocalDateFormat()}
- */
- @Deprecated
- public static DateFormat getThreadLocalDateFormat() {
-
- return DateUtil.getThreadLocalDateFormat();
- }
-
- /**
- * @deprecated Use {@link org.apache.solr.common.util.DateUtil#UTC}.
- */
- @Deprecated
- public static TimeZone UTC = DateUtil.UTC;
-
-
-
- /**
* See: {@link org.apache.lucene.queryparser.classic queryparser syntax}
* for more information on Escaping Special Characters
*/
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java Sun Feb 8 23:53:14 2015
@@ -17,6 +17,12 @@ package org.apache.solr.common.cloud;
* limitations under the License.
*/
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
+import org.noggit.JSONWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -26,12 +32,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
-import org.noggit.JSONWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* Immutable state of the cloud. Normally you can get the state by using
* {@link ZkStateReader#getClusterState()}.
@@ -45,18 +45,6 @@ public class ClusterState implements JSO
private final Map<String, CollectionRef> collectionStates;
private Set<String> liveNodes;
-
- /**
- * Use this constr when ClusterState is meant for publication.
- *
- * hashCode and equals will only depend on liveNodes and not clusterStateVersion.
- */
- @Deprecated
- public ClusterState(Set<String> liveNodes,
- Map<String, DocCollection> collectionStates) {
- this(null, liveNodes, collectionStates);
- }
-
/**
* Use this constr when ClusterState is meant for consumption.
*/
@@ -177,6 +165,9 @@ public class ClusterState implements JSO
return coll;
}
+ public CollectionRef getCollectionRef(String coll) {
+ return collectionStates.get(coll);
+ }
public DocCollection getCollectionOrNull(String coll) {
CollectionRef ref = collectionStates.get(coll);
@@ -325,16 +316,6 @@ public class ClusterState implements JSO
@Override
public void write(JSONWriter jsonWriter) {
- if (collectionStates.size() == 1) {
- CollectionRef ref = collectionStates.values().iterator().next();
- DocCollection docCollection = ref.get();
- if (docCollection.getStateFormat() > 1) {
- jsonWriter.write(Collections.singletonMap(docCollection.getName(), docCollection));
- // serializing a single DocCollection that is persisted outside of clusterstate.json
- return;
- }
- }
-
LinkedHashMap<String , DocCollection> map = new LinkedHashMap<>();
for (Entry<String, CollectionRef> e : collectionStates.entrySet()) {
// using this class check to avoid fetching from ZK in case of lazily loaded collection
@@ -409,6 +390,8 @@ public class ClusterState implements JSO
return coll;
}
+ public boolean isLazilyLoaded() { return false; }
+
}
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ImplicitDocRouter.java Sun Feb 8 23:53:14 2015
@@ -31,9 +31,9 @@ import static org.apache.solr.common.par
/** This document router is for custom sharding
*/
public class ImplicitDocRouter extends DocRouter {
+
public static final String NAME = "implicit";
-// @Deprecated
-// public static final String DEFAULT_SHARD_PARAM = "_shard_";
+
private static Logger log = LoggerFactory
.getLogger(ImplicitDocRouter.class);
@@ -49,7 +49,6 @@ public class ImplicitDocRouter extends D
}
if(shard == null) {
Object o = sdoc.getFieldValue(_ROUTE_);
- if (o == null) o = sdoc.getFieldValue("_shard_");//deprecated . for backcompat remove later
if (o != null) {
shard = o.toString();
}
@@ -58,7 +57,6 @@ public class ImplicitDocRouter extends D
if (shard == null) {
shard = params.get(_ROUTE_);
- if(shard == null) shard =params.get("_shard_"); //deperecated for back compat
}
if (shard != null) {
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java Sun Feb 8 23:53:14 2015
@@ -26,7 +26,6 @@ import java.nio.charset.StandardCharsets
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicLong;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
@@ -40,8 +39,8 @@ import org.apache.solr.common.SolrExcept
import org.apache.solr.common.StringUtils;
import org.apache.solr.common.cloud.ZkClientConnectionStrategy.ZkUpdate;
import org.apache.solr.common.util.ExecutorUtil;
+import org.apache.solr.common.util.ObjectReleaseTracker;
import org.apache.solr.common.util.SolrjNamedThreadFactory;
-import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.KeeperException.NoNodeException;
@@ -62,9 +61,6 @@ import org.slf4j.LoggerFactory;
*
*/
public class SolrZkClient implements Closeable {
- // These should *only* be used for debugging or monitoring purposes
- public static final AtomicLong numOpens = new AtomicLong();
- public static final AtomicLong numCloses = new AtomicLong();
static final String NEWL = System.getProperty("line.separator");
@@ -183,7 +179,7 @@ public class SolrZkClient implements Clo
}
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
- numOpens.incrementAndGet();
+ assert ObjectReleaseTracker.track(this);
if (zkACLProvider == null) {
this.zkACLProvider = createZkACLProvider();
} else {
@@ -644,7 +640,7 @@ public class SolrZkClient implements Clo
connManager.close();
closeCallbackExecutor();
}
- numCloses.incrementAndGet();
+ assert ObjectReleaseTracker.release(this);
}
public boolean isClosed() {
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java Sun Feb 8 23:53:14 2015
@@ -273,6 +273,7 @@ public class ZkStateReader implements Cl
if (collection.getZNodeVersion() < version) {
log.debug("server older than client {}<{}", collection.getZNodeVersion(), version);
DocCollection nu = getCollectionLive(this, coll);
+ if (nu == null) return null;
if (nu.getZNodeVersion() > collection.getZNodeVersion()) {
updateWatchedCollection(nu);
collection = nu;
@@ -454,9 +455,11 @@ public class ZkStateReader implements Cl
synchronized (this) {
if (watchedCollections.contains(s)) {
DocCollection live = getCollectionLive(this, s);
- watchedCollectionStates.put(s, live);
- // if it is a watched collection, add too
- result.put(s, new ClusterState.CollectionRef(live));
+ if (live != null) {
+ watchedCollectionStates.put(s, live);
+ // if it is a watched collection, add too
+ result.put(s, new ClusterState.CollectionRef(live));
+ }
} else {
// if it is not collection, then just create a reference which can fetch
// the collection object just in time from ZK
@@ -468,6 +471,9 @@ public class ZkStateReader implements Cl
public DocCollection get() {
return getCollectionLive(ZkStateReader.this, collName);
}
+
+ @Override
+ public boolean isLazilyLoaded() { return true; }
});
}
}
@@ -527,7 +533,10 @@ public class ZkStateReader implements Cl
}
synchronized (ZkStateReader.this) {
for (String watchedCollection : watchedCollections) {
- updateWatchedCollection(getCollectionLive(this, watchedCollection));
+ DocCollection live = getCollectionLive(this, watchedCollection);
+ if (live != null) {
+ updateWatchedCollection(live);
+ }
}
}
@@ -585,7 +594,11 @@ public class ZkStateReader implements Cl
synchronized (ZkStateReader.this) {
for (String watchedCollection : watchedCollections) {
- updateWatchedCollection(getCollectionLive(ZkStateReader.this, watchedCollection));
+ DocCollection live = getCollectionLive(ZkStateReader.this, watchedCollection);
+ assert live != null;
+ if (live != null) {
+ updateWatchedCollection(live);
+ }
}
}
}
@@ -878,7 +891,10 @@ public class ZkStateReader implements Cl
};
zkClient.exists(fullpath, watcher, true);
}
- updateWatchedCollection(getCollectionLive(this, coll));
+ DocCollection collection = getCollectionLive(this, coll);
+ if (collection != null) {
+ updateWatchedCollection(collection);
+ }
}
private void updateWatchedCollection(DocCollection newState) {
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/AppendedSolrParams.java Sun Feb 8 23:53:14 2015
@@ -24,11 +24,11 @@ package org.apache.solr.common.params;
*/
public class AppendedSolrParams extends DefaultSolrParams {
- /**
- * @deprecated (3.6) Use {@link SolrParams#wrapAppended(SolrParams, SolrParams)} instead.
- */
- @Deprecated
- public AppendedSolrParams(SolrParams main, SolrParams extra) {
+ public static AppendedSolrParams wrapAppended(SolrParams params, SolrParams extra) {
+ return new AppendedSolrParams(params, extra);
+ }
+
+ private AppendedSolrParams(SolrParams main, SolrParams extra) {
super(main, extra);
}
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/DefaultSolrParams.java Sun Feb 8 23:53:14 2015
@@ -24,14 +24,11 @@ import java.util.LinkedHashSet;
*
*/
public class DefaultSolrParams extends SolrParams {
+
protected final SolrParams params;
protected final SolrParams defaults;
- /**
- * @deprecated (3.6) Use {@link SolrParams#wrapDefaults(SolrParams, SolrParams)} instead.
- */
- @Deprecated
- public DefaultSolrParams(SolrParams params, SolrParams defaults) {
+ protected DefaultSolrParams(SolrParams params, SolrParams defaults) {
assert params != null && defaults != null;
this.params = params;
this.defaults = defaults;
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/FacetParams.java Sun Feb 8 23:53:14 2015
@@ -310,25 +310,6 @@ public interface FacetParams {
}
/**
- * @deprecated Use {@link FacetRangeOther}
- */
- @Deprecated
- public enum FacetDateOther {
- BEFORE, AFTER, BETWEEN, ALL, NONE;
- @Override
- public String toString() { return super.toString().toLowerCase(Locale.ROOT); }
- public static FacetDateOther get(String label) {
- try {
- return valueOf(label.toUpperCase(Locale.ROOT));
- } catch (IllegalArgumentException e) {
- throw new SolrException
- (SolrException.ErrorCode.BAD_REQUEST,
- label+" is not a valid type of 'other' range facet information",e);
- }
- }
- }
-
- /**
* An enumeration of the legal values for {@link #FACET_DATE_INCLUDE} and {@link #FACET_RANGE_INCLUDE}
* <p>
* <ul>
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/HighlightParams.java Sun Feb 8 23:53:14 2015
@@ -52,6 +52,7 @@ public interface HighlightParams {
public static final String USE_PHRASE_HIGHLIGHTER = HIGHLIGHT+".usePhraseHighlighter";
public static final String HIGHLIGHT_MULTI_TERM = HIGHLIGHT+".highlightMultiTerm";
+ public static final String PAYLOADS = HIGHLIGHT+".payloads";
public static final String MERGE_CONTIGUOUS_FRAGMENTS = HIGHLIGHT + ".mergeContiguous";
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/MapSolrParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/MapSolrParams.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/MapSolrParams.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/MapSolrParams.java Sun Feb 8 23:53:14 2015
@@ -19,6 +19,7 @@ package org.apache.solr.common.params;
import org.apache.solr.common.util.StrUtils;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.io.IOException;
@@ -35,13 +36,22 @@ public class MapSolrParams extends SolrP
@Override
public String get(String name) {
- return map.get(name);
+ Object o = map.get(name);
+ if(o == null) return null;
+ if (o instanceof String) return (String) o;
+ if (o instanceof String[]) {
+ String[] strings = (String[]) o;
+ if(strings.length == 0) return null;
+ return strings[0];
+ }
+ return String.valueOf(o);
}
@Override
public String[] getParams(String name) {
- String val = map.get(name);
- return val==null ? null : new String[]{val};
+ Object val = map.get(name);
+ if (val instanceof String[]) return (String[]) val;
+ return val==null ? null : new String[]{String.valueOf(val)};
}
@Override
@@ -59,13 +69,16 @@ public class MapSolrParams extends SolrP
for (Map.Entry<String,String> entry : map.entrySet()) {
String key = entry.getKey();
- String val = entry.getValue();
-
+ Object val = entry.getValue();
+ if (val instanceof String[]) {
+ String[] strings = (String[]) val;
+ val = StrUtils.join(Arrays.asList(strings),',');
+ }
if (!first) sb.append('&');
first=false;
sb.append(key);
sb.append('=');
- StrUtils.partialURLEncodeVal(sb, val==null ? "" : val);
+ StrUtils.partialURLEncodeVal(sb, val==null ? "" : String.valueOf(val));
}
}
catch (IOException e) {throw new RuntimeException(e);} // can't happen
Modified: lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java?rev=1658277&r1=1658276&r2=1658277&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java (original)
+++ lucene/dev/branches/lucene6005/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java Sun Feb 8 23:53:14 2015
@@ -45,10 +45,6 @@ public interface ShardParams {
/** Should things fail if there is an error? (true/false) */
public static final String SHARDS_TOLERANT = "shards.tolerant";
-
- /** Should things fail if there is an error? (true/false) */
- @Deprecated
- public static final String SHARD_KEYS = "shard.keys";
/** query purpose for shard requests */
public static final String SHARDS_PURPOSE = "shards.purpose";