Skip to content

Apache Lucene open-source search software

Fix Solr smoke tests: SYSTEM_REQUIREMENTS no longer exists where it was testing for it (merged from r1652718)

Erik Hatcher22d0422663e1
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index 7620c99cdc8..202e10da96c 100644
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -635,8 +635,6 @@ def verifyUnpacked(java, project, artifact, unpackPath, svnRevision, version, te
textFiles.extend(('JRE_VERSION_MIGRATION', 'CHANGES', 'MIGRATE', 'SYSTEM_REQUIREMENTS'))
if isSrc:
textFiles.append('BUILD')
- elif not isSrc:
- textFiles.append('SYSTEM_REQUIREMENTS')
for fileName in textFiles:
fileName += '.txt'
@@ -686,8 +684,6 @@ def verifyUnpacked(java, project, artifact, unpackPath, svnRevision, version, te
if project == 'lucene':
if len(l) > 0:
raise RuntimeError('%s: unexpected files/dirs in artifact %s: %s' % (project, artifact, l))
- elif isSrc and not os.path.exists('%s/solr/SYSTEM_REQUIREMENTS.txt' % unpackPath):
- raise RuntimeError('%s: solr/SYSTEM_REQUIREMENTS.txt does not exist in artifact %s' % (project, artifact))
if isSrc:
print(' make sure no JARs/WARs in src dist...')
diff --git a/solr/bin/post b/solr/bin/post
index d6b7f55fb7c..6f5ca0babdb 100755
--- a/solr/bin/post
+++ b/solr/bin/post
@@ -16,9 +16,7 @@
# TODO wishlist:
# - handle stdin as well, such that `cat foo.csv | bin/post my_collection` works
-# - bin/post collection "file with spaces.csv" does not work, breaks arguments at whitespace apparently.
# - support arbitrary posting like - java -Ddata=args org.apache.solr.util.SimplePostTool "<delete><id>SP2514N</id></delete>"
-# - convert OPTIONS (key=val pass-through to SPT) to standard 'nix switches
# ====== Common code copied/adapted from bin/solr (TODO: centralize/share this kind of thing)
diff --git a/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java b/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
index 857199cb89d..187ff0e92e9 100644
--- a/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
+++ b/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
@@ -45,6 +45,7 @@ import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
import org.apache.velocity.tools.ConversionUtils;
import org.apache.velocity.tools.generic.ComparisonDateTool;
+import org.apache.velocity.tools.generic.ContextTool;
import org.apache.velocity.tools.generic.DisplayTool;
import org.apache.velocity.tools.generic.EscapeTool;
import org.apache.velocity.tools.generic.ListTool;
@@ -185,6 +186,7 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar
context.put("request", request);
// Register useful Velocity "tools"
+ context.put("log", log); // TODO: add test
context.put("esc", new EscapeTool());
context.put("date", new ComparisonDateTool());
context.put("list", new ListTool());
@@ -232,7 +234,7 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar
// Set some engine properties that improve the experience
// - these could be considered in the future for parameterization, but can also be overridden by using
- // the init.properties.file setting. (TODO: add a test for this)
+ // the init.properties.file setting. (TODO: add a test for this properties set here overridden)
// load the built-in _macros.vm first, then load VM_global_library.vm for legacy (pre-5.0) support,
// and finally allow macros.vm to have the final say and override anything defined in the preceding files.
diff --git a/solr/contrib/velocity/src/resources/velocity/browse.vm b/solr/contrib/velocity/src/resources/velocity/browse.vm
index 5e7ec68add6..b651295b054 100644
--- a/solr/contrib/velocity/src/resources/velocity/browse.vm
+++ b/solr/contrib/velocity/src/resources/velocity/browse.vm
@@ -1,3 +1,9 @@
+#*
+ - Make search box bigger
+ - Add in pivot and other facets?
+ - Work on template default selection logic
+*#
+
## Show Error Message, if any
<div class="error">
#parse("error.vm")
diff --git a/solr/example/files/README.txt b/solr/example/files/README.txt
new file mode 100644
index 00000000000..fd4dad02949
--- /dev/null
+++ b/solr/example/files/README.txt
@@ -0,0 +1,16 @@
+bin/solr stop
+rm -Rf server/solr/files/
+
+# templates extracted with:
+# unzip -j dist/solr-velocity-*.jar velocity/* -x *.properties -d example/files/templates/
+bin/solr start -Dvelocity.template.base.dir=<absolute path to example/files/templates>
+# TODO: make it so an install dir relative path can be used somehow?
+bin/solr create_core -c files
+bin/post -c files ~/Documents
+curl http://localhost:8983/solr/files/config/params -H 'Content-type:application/json' -d '{
+"update" : {
+ "facets": {
+ "facet.field":"content_type"
+ }
+ }
+}'
\ No newline at end of file
diff --git a/solr/example/files/templates/d3.vm b/solr/example/files/templates/d3.vm
new file mode 100644
index 00000000000..5dc25c47b75
--- /dev/null
+++ b/solr/example/files/templates/d3.vm
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+ <title>Practice Assignment 1</title>
+
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
+ <script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
+
+ <style>
+
+ body {
+ font: 10px sans-serif;
+ }
+
+ .chart {
+ font-family: Arial, sans-serif;
+ font-size: 10px;
+ }
+
+ .axis path, .axis line {
+ fill: none;
+ stroke: #0000ff;
+ shape-rendering: crispEdges;
+ }
+
+ .bar {
+ z-index: 1000;
+ }
+
+/* #bar-demo {
+ border: solid;
+ }
+*/
+ .chart {
+ border: solid;
+ }
+
+ </style>
+
+<script type="text/javascript">
+$(document).ready(function(){
+
+#set($content_types=$response.response.facet_counts.facet_fields.content_type)
+var data=[#foreach($facet in $content_types){"key": "$facet.key", "val": $facet.value}#if($velocityCount != $content_types.size()),#end$#end];
+
+
+//var margin = {top: 40, right: 40, bottom: 40, left:40},
+ width = 600,
+ height = 500;
+
+
+var x = d3.scale.linear()
+ .domain([0, d3.max(data, function(d) { return +d.val;})])
+ .range([0, width]);
+
+var y = d3.scale.ordinal()
+ .domain(data.map(function(d) {return d.key;}))
+ .rangeBands([height,0])
+
+var svg = d3.select('#bar-demo').append('svg')
+ .attr('class', 'chart')
+ .attr('width', width)
+ .attr('height', height)
+ .append('g');
+
+
+var colors = d3.scale.category20();
+
+svg.selectAll('.chart')
+ .data(data)
+ .enter().append('rect')
+ .attr('class', 'bar')
+ .attr("fill",function(d,i){return colors(i);})
+ .attr('x', function(d) { return 0; })
+ .attr('y', function(d) { return y(d.key); })
+ .attr('height', function(d) {return y.rangeBand();})
+ .attr('width', function(d) { return x(+d.val) });
+
+ svg.selectAll(".rect")
+ .data(data)
+ .enter().append("svg:text")
+ .attr("x", function(d) { return 0; })
+ .attr("y", function(d) { return y(d.key) + y.rangeBand()/2; })
+ .attr("dx", "0.5em")
+ .attr("dy", "1.50em")
+ .attr("text-anchor", "left")
+ .text(function(d) { return d.key + " (" + d.val + ")" });
+});
+
+</script>
+
+</head>
+ <body>
+
+ <div id="admin"><a href="#url_root/#/#core_name">Solr Admin</a></div>
+ <div><a href="#url_for_home">Home</a></div>
+ <div id="head">
+ <a href="#url_for_home#if($debug)?debug=true#end"><img src="#{url_root}/img/solr.svg" id="logo"/></a>
+ </div>
+
+<pre>
+ $response.response.facet_counts.facet_fields.content_type
+</pre>
+
+<hr/>
+
+
+ <div id="bar-demo" style="position: relative; top: 3px; left: 20px;"></div>
+
+</body>
+</html>