You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by eh...@apache.org on 2015/09/09 02:30:58 UTC
svn commit: r1701886 - in /lucene/dev/branches/lucene_solr_5_3: ./ solr/
solr/contrib/ solr/contrib/velocity/src/java/org/apache/solr/response/
solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/
solr/contrib/velocity/src/test...
Author: ehatcher
Date: Wed Sep 9 00:30:57 2015
New Revision: 1701886
URL: http://svn.apache.org/r1701886
Log:
SOLR-7972, SOLR-7929, SOLR-7978: merge fixes to 5.3 branch for 5.3.1 release
Added:
lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/encoding.vm (props changed)
- copied unchanged from r1697790, lucene/dev/branches/branch_5x/solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/encoding.vm
lucene/dev/branches/lucene_solr_5_3/solr/core/src/test-files/solr/collection1/conf/cross-compatible.js
- copied unchanged from r1701884, lucene/dev/branches/branch_5x/solr/core/src/test-files/solr/collection1/conf/cross-compatible.js
Modified:
lucene/dev/branches/lucene_solr_5_3/ (props changed)
lucene/dev/branches/lucene_solr_5_3/solr/ (props changed)
lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/lucene_solr_5_3/solr/contrib/ (props changed)
lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java
lucene/dev/branches/lucene_solr_5_3/solr/core/ (props changed)
lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
lucene/dev/branches/lucene_solr_5_3/solr/core/src/test-files/solr/collection1/conf/solrconfig-script-updateprocessor.xml
lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java
lucene/dev/branches/lucene_solr_5_3/solr/example/ (props changed)
lucene/dev/branches/lucene_solr_5_3/solr/example/files/conf/update-script.js
Modified: lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt?rev=1701886&r1=1701885&r2=1701886&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt Wed Sep 9 00:30:57 2015
@@ -19,6 +19,13 @@ Bug Fixes
* SOLR-8004: RuleBasedAuthorization plugin does not work for the collection-admin-edit permission (noble)
+* SOLR-7972: Fix VelocityResponseWriter template encoding issue.
+ Templates must be UTF-8 encoded. (Erik Hatcher)
+
+* SOLR-7929: SimplePostTool (also bin/post) -filetypes "*" now works properly in 'web' mode (Erik Hatcher)
+
+* SOLR-7978: Fixed example/files update-script.js to be Java 7 and 8 compatible. (Erik Hatcher)
+
================== 5.3.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
Modified: lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java?rev=1701886&r1=1701885&r2=1701886&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java Wed Sep 9 00:30:57 2015
@@ -282,6 +282,8 @@ public class VelocityResponseWriter impl
engine.setProperty(RuntimeConstants.RESOURCE_LOADER, StringUtils.join(loaders,','));
+ engine.setProperty(RuntimeConstants.INPUT_ENCODING, "UTF-8");
+
// bring in any custom properties too
engine.init(velocityInitProps);
Modified: lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java?rev=1701886&r1=1701885&r2=1701886&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java Wed Sep 9 00:30:57 2015
@@ -93,6 +93,11 @@ public class VelocityResponseWriterTest
}
@Test
+ public void testEncoding() throws Exception {
+ assertEquals("éñçøâîñg", h.query(req("q","*:*", "wt","velocity",VelocityResponseWriter.TEMPLATE,"encoding")));
+ }
+
+ @Test
public void testMacros() throws Exception {
// tests that a macro in a custom macros.vm is visible
assertEquals("test_macro_SUCCESS", h.query(req("q","*:*", "wt","velocity",VelocityResponseWriter.TEMPLATE,"test_macro_visible")));
Modified: lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/util/SimplePostTool.java?rev=1701886&r1=1701885&r2=1701886&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/util/SimplePostTool.java (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/util/SimplePostTool.java Wed Sep 9 00:30:57 2015
@@ -1093,7 +1093,7 @@ public class SimplePostTool {
// Raw content type of form "text/html; encoding=utf-8"
String rawContentType = conn.getContentType();
String type = rawContentType.split(";")[0];
- if(typeSupported(type)) {
+ if(typeSupported(type) || "*".equals(fileTypes)) {
String encoding = conn.getContentEncoding();
InputStream is;
if (encoding != null && encoding.equalsIgnoreCase("gzip")) {
Modified: lucene/dev/branches/lucene_solr_5_3/solr/core/src/test-files/solr/collection1/conf/solrconfig-script-updateprocessor.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/core/src/test-files/solr/collection1/conf/solrconfig-script-updateprocessor.xml?rev=1701886&r1=1701885&r2=1701886&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/core/src/test-files/solr/collection1/conf/solrconfig-script-updateprocessor.xml (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/core/src/test-files/solr/collection1/conf/solrconfig-script-updateprocessor.xml Wed Sep 9 00:30:57 2015
@@ -103,10 +103,17 @@
<str name="script">throw.error.on.add.updateprocessor.js</str>
</processor>
</updateRequestProcessorChain>
+
<updateRequestProcessorChain name="missing-functions">
<processor class="solr.StatelessScriptUpdateProcessorFactory">
<str name="script">missing.functions.updateprocessor.js</str>
</processor>
</updateRequestProcessorChain>
+ <updateRequestProcessorChain name="javascript-compatibility">
+ <processor class="solr.StatelessScriptUpdateProcessorFactory">
+ <str name="script">cross-compatible.js</str>
+ </processor>
+ </updateRequestProcessorChain>
+
</config>
Modified: lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java?rev=1701886&r1=1701885&r2=1701886&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java Wed Sep 9 00:30:57 2015
@@ -268,4 +268,14 @@ public class StatelessScriptUpdateProces
fail("Did not get exception from script");
}
+ public void testJavaScriptCompatibility() throws Exception {
+ final String chain = "javascript-compatibility";
+ SolrInputDocument d = processAdd(chain,
+ doc(f("id", "5"),
+ f("name", " foo "),
+ f("subject", "BAR")));
+ assertEquals("bar", d.getFieldValue("term_s"));
+
+ }
+
}
Modified: lucene/dev/branches/lucene_solr_5_3/solr/example/files/conf/update-script.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/example/files/conf/update-script.js?rev=1701886&r1=1701885&r2=1701886&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/example/files/conf/update-script.js (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/example/files/conf/update-script.js Wed Sep 9 00:30:57 2015
@@ -1,6 +1,15 @@
-/*
- See http://wiki.apache.org/solr/ScriptUpdateProcessor for more details.
-*/
+function get_class(name) {
+ var clazz;
+ try {
+ // Java8 Nashorn
+ clazz = eval("Java.type(name).class");
+ } catch(e) {
+ // Java7 Rhino
+ clazz = eval("Packages."+name);
+ }
+
+ return clazz;
+}
function processAdd(cmd) {
@@ -69,10 +78,9 @@ function processAdd(cmd) {
.getIndexAnalyzer();
var token_stream =
- analyzer.tokenStream("content", new java.io.StringReader(doc.getFieldValue("content")));
-
- var term_att = token_stream.getAttribute(Packages.org.apache.lucene.analysis.tokenattributes.CharTermAttribute);
- var type_att = token_stream.getAttribute(Packages.org.apache.lucene.analysis.tokenattributes.TypeAttribute);
+ analyzer.tokenStream("content", doc.getFieldValue("content"));
+ var term_att = token_stream.getAttribute(get_class("org.apache.lucene.analysis.tokenattributes.CharTermAttribute"));
+ var type_att = token_stream.getAttribute(get_class("org.apache.lucene.analysis.tokenattributes.TypeAttribute"));
token_stream.reset();
while (token_stream.incrementToken()) {
doc.addField(type_att.type().replaceAll(/\<|\>/g,"").toLowerCase()+"_ss", term_att.toString());