mirror of https://github.com/apache/lucene.git
SOLR-13971: Removing velocity from _default and disabling custom template support by default
This commit is contained in:
parent
e681f9dca4
commit
05c5bcc8b3
|
@ -144,6 +144,9 @@ Bug Fixes
|
||||||
|
|
||||||
* SOLR-13963: JavaBinCodec has concurrent modification of CharArr resulting in corrupt internode updates (Colvin Cowie, noble)
|
* SOLR-13963: JavaBinCodec has concurrent modification of CharArr resulting in corrupt internode updates (Colvin Cowie, noble)
|
||||||
|
|
||||||
|
* SOLR-13971: Velocity response writer's resource loading now possible only through startup parameters. Also, removed velocity
|
||||||
|
response writer from _default configset. (Ishan Chattopadhyaya)
|
||||||
|
|
||||||
================== 8.3.0 ==================
|
================== 8.3.0 ==================
|
||||||
|
|
||||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||||
|
|
|
@ -62,9 +62,11 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar
|
||||||
// init param names, these are _only_ loaded at init time (no per-request control of these)
|
// init param names, these are _only_ loaded at init time (no per-request control of these)
|
||||||
// - multiple different named writers could be created with different init params
|
// - multiple different named writers could be created with different init params
|
||||||
public static final String TEMPLATE_BASE_DIR = "template.base.dir";
|
public static final String TEMPLATE_BASE_DIR = "template.base.dir";
|
||||||
|
public static final String PROPERTIES_FILE = "init.properties.file";
|
||||||
|
|
||||||
|
// System property names, these are _only_ loaded at node startup (no per-request control of these)
|
||||||
public static final String PARAMS_RESOURCE_LOADER_ENABLED = "params.resource.loader.enabled";
|
public static final String PARAMS_RESOURCE_LOADER_ENABLED = "params.resource.loader.enabled";
|
||||||
public static final String SOLR_RESOURCE_LOADER_ENABLED = "solr.resource.loader.enabled";
|
public static final String SOLR_RESOURCE_LOADER_ENABLED = "solr.resource.loader.enabled";
|
||||||
public static final String PROPERTIES_FILE = "init.properties.file";
|
|
||||||
|
|
||||||
// request param names
|
// request param names
|
||||||
public static final String TEMPLATE = "v.template";
|
public static final String TEMPLATE = "v.template";
|
||||||
|
@ -106,12 +108,12 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar
|
||||||
}
|
}
|
||||||
|
|
||||||
// params resource loader: off by default
|
// params resource loader: off by default
|
||||||
Boolean prle = args.getBooleanArg(PARAMS_RESOURCE_LOADER_ENABLED);
|
Boolean prle = Boolean.getBoolean(PARAMS_RESOURCE_LOADER_ENABLED);
|
||||||
paramsResourceLoaderEnabled = (null == prle ? false : prle);
|
paramsResourceLoaderEnabled = (null == prle ? false : prle);
|
||||||
|
|
||||||
// solr resource loader: on by default
|
// solr resource loader: off by default
|
||||||
Boolean srle = args.getBooleanArg(SOLR_RESOURCE_LOADER_ENABLED);
|
Boolean srle = Boolean.getBoolean(SOLR_RESOURCE_LOADER_ENABLED);
|
||||||
solrResourceLoaderEnabled = (null == srle ? true : srle);
|
solrResourceLoaderEnabled = (null == srle ? false : srle);
|
||||||
|
|
||||||
initPropertiesFileName = (String) args.get(PROPERTIES_FILE);
|
initPropertiesFileName = (String) args.get(PROPERTIES_FILE);
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,25 @@ import org.apache.solr.response.QueryResponseWriter;
|
||||||
import org.apache.solr.response.SolrParamResourceLoader;
|
import org.apache.solr.response.SolrParamResourceLoader;
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
import org.apache.solr.response.SolrQueryResponse;
|
||||||
import org.apache.solr.response.VelocityResponseWriter;
|
import org.apache.solr.response.VelocityResponseWriter;
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class VelocityResponseWriterTest extends SolrTestCaseJ4 {
|
public class VelocityResponseWriterTest extends SolrTestCaseJ4 {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
|
System.setProperty("params.resource.loader.enabled", "true");
|
||||||
|
System.setProperty("solr.resource.loader.enabled", "true");
|
||||||
initCore("solrconfig.xml", "schema.xml", getFile("velocity/solr").getAbsolutePath());
|
initCore("solrconfig.xml", "schema.xml", getFile("velocity/solr").getAbsolutePath());
|
||||||
System.out.println(getFile("velocity/solr").getAbsolutePath());
|
System.out.println(getFile("velocity/solr").getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void afterClass() throws Exception {
|
||||||
|
System.clearProperty("params.resource.loader.enabled");
|
||||||
|
System.clearProperty("solr.resource.loader.enabled");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testVelocityResponseWriterRegistered() {
|
public void testVelocityResponseWriterRegistered() {
|
||||||
QueryResponseWriter writer = h.getCore().getQueryResponseWriter("velocity");
|
QueryResponseWriter writer = h.getCore().getQueryResponseWriter("velocity");
|
||||||
|
|
|
@ -81,8 +81,6 @@
|
||||||
<lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
|
<lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
|
||||||
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />
|
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />
|
||||||
|
|
||||||
<lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
|
|
||||||
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
|
|
||||||
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-ltr-\d.*\.jar" />
|
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-ltr-\d.*\.jar" />
|
||||||
|
|
||||||
<!-- an exact 'path' can be used instead of a 'dir' to specify a
|
<!-- an exact 'path' can be used instead of a 'dir' to specify a
|
||||||
|
@ -789,7 +787,7 @@
|
||||||
(SearchHandler) can be registered multiple times with different
|
(SearchHandler) can be registered multiple times with different
|
||||||
names (and different init parameters)
|
names (and different init parameters)
|
||||||
-->
|
-->
|
||||||
<requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,velocity,browse">
|
<requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,browse">
|
||||||
<lst name="defaults">
|
<lst name="defaults">
|
||||||
<str name="echoParams">explicit</str>
|
<str name="echoParams">explicit</str>
|
||||||
</lst>
|
</lst>
|
||||||
|
@ -1299,15 +1297,6 @@
|
||||||
<str name="content-type">text/plain; charset=UTF-8</str>
|
<str name="content-type">text/plain; charset=UTF-8</str>
|
||||||
</queryResponseWriter>
|
</queryResponseWriter>
|
||||||
|
|
||||||
<!--
|
|
||||||
Custom response writers can be declared as needed...
|
|
||||||
-->
|
|
||||||
<queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
|
|
||||||
<str name="template.base.dir">${velocity.template.base.dir:}</str>
|
|
||||||
<str name="solr.resource.loader.enabled">${velocity.solr.resource.loader.enabled:true}</str>
|
|
||||||
<str name="params.resource.loader.enabled">${velocity.params.resource.loader.enabled:false}</str>
|
|
||||||
</queryResponseWriter>
|
|
||||||
|
|
||||||
<!-- XSLT response writer transforms the XML output by any xslt file found
|
<!-- 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
|
in Solr's conf/xslt directory. Changes to xslt files are checked for
|
||||||
every xsltCacheLifetimeSeconds.
|
every xsltCacheLifetimeSeconds.
|
||||||
|
|
|
@ -81,8 +81,6 @@
|
||||||
<lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
|
<lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
|
||||||
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />
|
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />
|
||||||
|
|
||||||
<lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
|
|
||||||
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
|
|
||||||
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-ltr-\d.*\.jar" />
|
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-ltr-\d.*\.jar" />
|
||||||
|
|
||||||
<!-- an exact 'path' can be used instead of a 'dir' to specify a
|
<!-- an exact 'path' can be used instead of a 'dir' to specify a
|
||||||
|
@ -789,7 +787,7 @@
|
||||||
(SearchHandler) can be registered multiple times with different
|
(SearchHandler) can be registered multiple times with different
|
||||||
names (and different init parameters)
|
names (and different init parameters)
|
||||||
-->
|
-->
|
||||||
<requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,velocity,browse">
|
<requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,browse">
|
||||||
<lst name="defaults">
|
<lst name="defaults">
|
||||||
<str name="echoParams">explicit</str>
|
<str name="echoParams">explicit</str>
|
||||||
</lst>
|
</lst>
|
||||||
|
@ -1299,15 +1297,6 @@
|
||||||
<str name="content-type">text/plain; charset=UTF-8</str>
|
<str name="content-type">text/plain; charset=UTF-8</str>
|
||||||
</queryResponseWriter>
|
</queryResponseWriter>
|
||||||
|
|
||||||
<!--
|
|
||||||
Custom response writers can be declared as needed...
|
|
||||||
-->
|
|
||||||
<queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
|
|
||||||
<str name="template.base.dir">${velocity.template.base.dir:}</str>
|
|
||||||
<str name="solr.resource.loader.enabled">${velocity.solr.resource.loader.enabled:true}</str>
|
|
||||||
<str name="params.resource.loader.enabled">${velocity.params.resource.loader.enabled:false}</str>
|
|
||||||
</queryResponseWriter>
|
|
||||||
|
|
||||||
<!-- XSLT response writer transforms the XML output by any xslt file found
|
<!-- 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
|
in Solr's conf/xslt directory. Changes to xslt files are checked for
|
||||||
every xsltCacheLifetimeSeconds.
|
every xsltCacheLifetimeSeconds.
|
||||||
|
|
|
@ -27,8 +27,6 @@ Its JAR and dependencies must be added (via `<lib>` or solr/home lib inclusion),
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<str name="init.properties.file">velocity-init.properties</str>
|
<str name="init.properties.file">velocity-init.properties</str>
|
||||||
<bool name="params.resource.loader.enabled">true</bool>
|
|
||||||
<bool name="solr.resource.loader.enabled">false</bool>
|
|
||||||
<lst name="tools">
|
<lst name="tools">
|
||||||
<str name="mytool">com.example.MyCustomTool</str>
|
<str name="mytool">com.example.MyCustomTool</str>
|
||||||
</lst>
|
</lst>
|
||||||
|
@ -36,16 +34,11 @@ Its JAR and dependencies must be added (via `<lib>` or solr/home lib inclusion),
|
||||||
</queryResponseWriter>
|
</queryResponseWriter>
|
||||||
----
|
----
|
||||||
|
|
||||||
The above example shows the optional initialization and custom tool parameters used by VelocityResponseWriter; these are detailed in the following table. These initialization parameters are only specified in the writer registration in `solrconfig.xml`, not as request-time parameters. See further below for request-time parameters.
|
The above example shows the optional initialization and custom tool parameters used by VelocityResponseWriter; these are detailed in the following table. These initialization parameters are only specified in the writer registration in `solrconfig.xml`, not as request-time parameters. In this example, all Solr nodes should be started with `-Dparams.resource.loader.enabled=true`. See further below for request-time parameters.
|
||||||
|
|
||||||
== Configuration & Usage
|
== Configuration & Usage
|
||||||
|
|
||||||
=== VelocityResponseWriter Initialization Parameters
|
=== VelocityResponseWriter Startup Parameters
|
||||||
|
|
||||||
`template.base.dir`::
|
|
||||||
If specified and exists as a file system directory, a file resource loader will be added for this directory. Templates in this directory will override "solr" resource loader templates.
|
|
||||||
|
|
||||||
`init.properties.file`:: Specifies a properties file name which must exist in the Solr `conf/` directory (*not* under a `velocity/` subdirectory) or root of a JAR file in a <lib>.
|
|
||||||
|
|
||||||
`params.resource.loader.enabled`::
|
`params.resource.loader.enabled`::
|
||||||
The "params" resource loader allows templates to be specified in Solr request parameters. For example:
|
The "params" resource loader allows templates to be specified in Solr request parameters. For example:
|
||||||
|
@ -58,6 +51,13 @@ where `v.template=custom` says to render a template called "custom" and the valu
|
||||||
`solr.resource.loader.enabled`::
|
`solr.resource.loader.enabled`::
|
||||||
The "solr" resource loader is the only template loader registered by default. Templates are served from resources visible to the SolrResourceLoader under a `velocity/` subdirectory. The VelocityResponseWriter itself has some built-in templates (in its JAR file, under `velocity/`) that are available automatically through this loader. These built-in templates can be overridden when the same template name is in conf/velocity/ or by using the `template.base.dir` option.
|
The "solr" resource loader is the only template loader registered by default. Templates are served from resources visible to the SolrResourceLoader under a `velocity/` subdirectory. The VelocityResponseWriter itself has some built-in templates (in its JAR file, under `velocity/`) that are available automatically through this loader. These built-in templates can be overridden when the same template name is in conf/velocity/ or by using the `template.base.dir` option.
|
||||||
|
|
||||||
|
=== VelocityResponseWriter Initialization Parameters
|
||||||
|
|
||||||
|
`template.base.dir`::
|
||||||
|
If specified and exists as a file system directory, a file resource loader will be added for this directory. Templates in this directory will override "solr" resource loader templates.
|
||||||
|
|
||||||
|
`init.properties.file`:: Specifies a properties file name which must exist in the Solr `conf/` directory (*not* under a `velocity/` subdirectory) or root of a JAR file in a <lib>.
|
||||||
|
|
||||||
`tools`::
|
`tools`::
|
||||||
External "tools" can be specified as list of string name/value (tool name / class name) pairs. Tools, in the Velocity context, are simply Java objects. Tool classes are constructed using a no-arg constructor (or a single-SolrCore-arg constructor if it exists) and added to the Velocity context with the specified name.
|
External "tools" can be specified as list of string name/value (tool name / class name) pairs. Tools, in the Velocity context, are simply Java objects. Tool classes are constructed using a no-arg constructor (or a single-SolrCore-arg constructor if it exists) and added to the Velocity context with the specified name.
|
||||||
+
|
+
|
||||||
|
|
Loading…
Reference in New Issue