SOLR-13971: Renamed the velocity template parameter names

This commit is contained in:
Ishan Chattopadhyaya 2019-11-28 15:42:36 +05:30
parent ee39b15b86
commit bf2899fb00
4 changed files with 18 additions and 9 deletions

View File

@ -86,6 +86,15 @@ Optimizations
---------------------
(No changes)
Upgrade Notes
----------------------
* Velocity response writer is no longer available to be used through the _default configset. In order
to use it, you would need to manually add it to your configset. Also, the initialization parameters
"params.resource.loader.enabled" and "solr.resource.loader.enabled" have been removed and replaced by
startup parameters "velocity.resourceloader.params.enabled" and "velocity.resourceloader.solr.enabled"
respectively (both turned off by default). Please see SOLR-13971 for more details.
Bug Fixes
---------------------

View File

@ -65,8 +65,8 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar
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 SOLR_RESOURCE_LOADER_ENABLED = "solr.resource.loader.enabled";
public static final String PARAMS_RESOURCE_LOADER_ENABLED = "velocity.resourceloader.params.enabled";
public static final String SOLR_RESOURCE_LOADER_ENABLED = "velocity.resourceloader.solr.enabled";
// request param names
public static final String TEMPLATE = "v.template";

View File

@ -34,16 +34,16 @@ import org.junit.Test;
public class VelocityResponseWriterTest extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
System.setProperty("params.resource.loader.enabled", "true");
System.setProperty("solr.resource.loader.enabled", "true");
System.setProperty("velocity.resourceloader.params.enabled", "true");
System.setProperty("velocity.resourceloader.solr.enabled", "true");
initCore("solrconfig.xml", "schema.xml", 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");
System.clearProperty("velocity.resourceloader.params.enabled");
System.clearProperty("velocity.resourceloader.solr.enabled");
}
@Test

View File

@ -34,13 +34,13 @@ Its JAR and dependencies must be added (via `<lib>` or solr/home lib inclusion),
</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. In this example, all Solr nodes should be started with `-Dparams.resource.loader.enabled=true`. 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 `-Dvelocity.resourceloader.params.enabled=true -Dvelocity.resourceloader.enabled=true`. See further below for request-time parameters.
== Configuration & Usage
=== VelocityResponseWriter Startup Parameters
`params.resource.loader.enabled`::
`velocity.resourceloader.params.enabled`::
The "params" resource loader allows templates to be specified in Solr request parameters. For example:
+
[source,bash]
@ -48,7 +48,7 @@ http://localhost:8983/solr/gettingstarted/select?q=\*:*&wt=velocity&v.template=c
+
where `v.template=custom` says to render a template called "custom" and the value of `v.template.custom` is the custom template. This is `false` by default; it'd be a niche, unusual, use case to need this enabled.
`solr.resource.loader.enabled`::
`velocity.resourceloader.solr.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.
=== VelocityResponseWriter Initialization Parameters