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 2012/12/29 09:41:54 UTC

svn commit: r1426716 - in /lucene/dev/trunk/solr: ./ contrib/velocity/ contrib/velocity/src/java/org/apache/solr/response/ example/solr/collection1/conf/velocity/ licenses/

Author: ehatcher
Date: Sat Dec 29 08:41:53 2012
New Revision: 1426716

URL: http://svn.apache.org/viewvc?rev=1426716&view=rev
Log:
SOLR-3725: Relocate the example mime-to-extension mapping, and upgrade Velocity Engine to 1.7

Added:
    lucene/dev/trunk/solr/licenses/velocity-1.7.jar.sha1
Removed:
    lucene/dev/trunk/solr/licenses/velocity-1.6.4.jar.sha1
Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/contrib/velocity/ivy.xml
    lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
    lucene/dev/trunk/solr/example/solr/collection1/conf/velocity/richtext-doc.vm

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1426716&r1=1426715&r2=1426716&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Sat Dec 29 08:41:53 2012
@@ -22,7 +22,27 @@ $Id$
 
 ==================  5.0.0 ==================
 
-(No changes)
+Versions of Major Components
+---------------------
+Apache Tika 1.2
+Carrot2 3.5.0
+Velocity 1.7 and Velocity Tools 2.0
+Apache UIMA 2.3.1
+Apache ZooKeeper 3.4.5
+
+Upgrading from Solr 4.x
+----------------------
+
+TBD...
+
+Detailed Change List
+----------------------
+
+Other Changes
+----------------------
+
+* SOLR-3735: Relocate the example mime-to-extension mapping, and
+  upgrade Velocity Engine to 1.7 (ehatcher)
 
 ==================  4.1.0 ==================
 

Modified: lucene/dev/trunk/solr/contrib/velocity/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/velocity/ivy.xml?rev=1426716&r1=1426715&r2=1426716&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/velocity/ivy.xml (original)
+++ lucene/dev/trunk/solr/contrib/velocity/ivy.xml Sat Dec 29 08:41:53 2012
@@ -21,7 +21,7 @@
     <dependencies>
       <dependency org="commons-beanutils" name="commons-beanutils" rev="1.7.0" transitive="false"/>
       <dependency org="commons-collections" name="commons-collections" rev="3.2.1" transitive="false"/>
-      <dependency org="org.apache.velocity" name="velocity" rev="1.6.4" transitive="false"/>
+      <dependency org="org.apache.velocity" name="velocity" rev="1.7" transitive="false"/>
       <dependency org="org.apache.velocity" name="velocity-tools" rev="2.0" transitive="false"/>
       <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/> 
     </dependencies>

Modified: lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java?rev=1426716&r1=1426715&r2=1426716&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java (original)
+++ lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java Sat Dec 29 08:41:53 2012
@@ -30,8 +30,6 @@ import org.apache.velocity.runtime.Runti
 import org.apache.velocity.tools.generic.*;
 
 import java.io.*;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Properties;
 
 public class VelocityResponseWriter implements QueryResponseWriter {
@@ -84,64 +82,6 @@ public class VelocityResponseWriter impl
 
     context.put("engine", engine);  // for $engine.resourceExists(...)
 
-    // Mimetype to extension map for detecting file type and show icon
-    // List of types match the icons in /solr/img/filetypes
-    Map<String, String> mimeToExt = new HashMap<String, String>() {{
-      put("application/x-7z-compressed", "7z");
-      put("application/postscript", "ai");
-      put("application/pgp-signature", "asc");
-      put("application/octet-stream", "bin");
-      put("application/x-bzip2", "bz2");
-      put("text/x-c", "c");
-      put("application/vnd.ms-htmlhelp", "chm");
-      put("application/java-vm", "class");
-      put("text/css", "css");
-      put("text/csv", "csv");
-      put("application/x-debian-package", "deb");
-      put("application/msword", "doc");
-      put("message/rfc822", "eml");
-      put("image/gif", "gif");
-      put("application/winhlp", "hlp");
-      put("text/html", "html");
-      put("application/java-archive", "jar");
-      put("text/x-java-source", "java");
-      put("image/jpeg", "jpeg");
-      put("application/javascript", "js");
-      put("application/vnd.oasis.opendocument.chart", "odc");
-      put("application/vnd.oasis.opendocument.formula", "odf");
-      put("application/vnd.oasis.opendocument.graphics", "odg");
-      put("application/vnd.oasis.opendocument.image", "odi");
-      put("application/vnd.oasis.opendocument.presentation", "odp");
-      put("application/vnd.oasis.opendocument.spreadsheet", "ods");
-      put("application/vnd.oasis.opendocument.text", "odt");
-      put("application/pdf", "pdf");
-      put("application/pgp-encrypted", "pgp");
-      put("image/png", "png");
-      put("application/vnd.ms-powerpoint", "ppt");
-      put("audio/x-pn-realaudio", "ram");
-      put("application/x-rar-compressed", "rar");
-      put("application/vnd.rn-realmedia", "rm");
-      put("application/rtf", "rtf");
-      put("application/x-shockwave-flash", "swf");
-      put("application/vnd.sun.xml.calc", "sxc");
-      put("application/vnd.sun.xml.draw", "sxd");
-      put("application/vnd.sun.xml.impress", "sxi");
-      put("application/vnd.sun.xml.writer", "sxw");
-      put("application/x-tar", "tar");
-      put("application/x-tex", "tex");
-      put("text/plain", "txt");
-      put("text/x-vcard", "vcf");
-      put("application/vnd.visio", "vsd");
-      put("audio/x-wav", "wav");
-      put("audio/x-ms-wma", "wma");
-      put("video/x-ms-wmv", "wmv");
-      put("application/vnd.ms-excel", "xls");
-      put("application/xml", "xml");
-      put("application/x-xpinstall", "xpi");
-      put("application/zip", "zip");
-    }};
-    context.put("mimeToExt", mimeToExt);
-    
     String layout_template = request.getParams().get("v.layout");
     String json_wrapper = request.getParams().get("v.json");
     boolean wrap_response = (layout_template != null) || (json_wrapper != null);

Modified: lucene/dev/trunk/solr/example/solr/collection1/conf/velocity/richtext-doc.vm
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/velocity/richtext-doc.vm?rev=1426716&r1=1426715&r2=1426716&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/solr/collection1/conf/velocity/richtext-doc.vm (original)
+++ lucene/dev/trunk/solr/example/solr/collection1/conf/velocity/richtext-doc.vm Sat Dec 29 08:41:53 2012
@@ -1,3 +1,59 @@
+## Mimetype to extension map for detecting file type and show icon
+## List of types match the icons in /solr/img/filetypes
+#set($extMap = {"application/x-7z-compressed": "7z",
+                 "application/postscript": "ai",
+                 "application/pgp-signature": "asc",
+                 "application/octet-stream": "bin",
+                 "application/x-bzip2": "bz2",
+                 "text/x-c": "c",
+                 "application/vnd.ms-htmlhelp": "chm",
+                 "application/java-vm": "class",
+                 "text/css": "css",
+                 "text/csv": "csv",
+                 "application/x-debian-package": "deb",
+                 "application/msword": "doc",
+                 "message/rfc822": "eml",
+                 "image/gif": "gif",
+                 "application/winhlp": "hlp",
+                 "text/html": "html",
+                 "application/java-archive": "jar",
+                 "text/x-java-source": "java",
+                 "image/jpeg": "jpeg",
+                 "application/javascript": "js",
+                 "application/vnd.oasis.opendocument.chart": "odc",
+                 "application/vnd.oasis.opendocument.formula": "odf",
+                 "application/vnd.oasis.opendocument.graphics": "odg",
+                 "application/vnd.oasis.opendocument.image": "odi",
+                 "application/vnd.oasis.opendocument.presentation": "odp",
+                 "application/vnd.oasis.opendocument.spreadsheet": "ods",
+                 "application/vnd.oasis.opendocument.text": "odt",
+                 "application/pdf": "pdf",
+                 "application/pgp-encrypted": "pgp",
+                 "image/png": "png",
+                 "application/vnd.ms-powerpoint": "ppt",
+                 "audio/x-pn-realaudio": "ram",
+                 "application/x-rar-compressed": "rar",
+                 "application/vnd.rn-realmedia": "rm",
+                 "application/rtf": "rtf",
+                 "application/x-shockwave-flash": "swf",
+                 "application/vnd.sun.xml.calc": "sxc",
+                 "application/vnd.sun.xml.draw": "sxd",
+                 "application/vnd.sun.xml.impress": "sxi",
+                 "application/vnd.sun.xml.writer": "sxw",
+                 "application/x-tar": "tar",
+                 "application/x-tex": "tex",
+                 "text/plain": "txt",
+                 "text/x-vcard": "vcf",
+                 "application/vnd.visio": "vsd",
+                 "audio/x-wav": "wav",
+                 "audio/x-ms-wma": "wma",
+                 "video/x-ms-wmv": "wmv",
+                 "application/vnd.ms-excel": "xls",
+                 "application/xml": "xml",
+                 "application/x-xpinstall": "xpi",
+                 "application/zip": "zip"})
+
+
 #if($doc.getFieldValue('title'))
   #set($title = $esc.html($doc.getFirstValue('title')))
 #else
@@ -13,10 +69,16 @@
 #set($supportedtypes = "7z;ai;aiff;asc;audio;bin;bz2;c;cfc;cfm;chm;class;conf;cpp;cs;css;csv;deb;divx;doc;dot;eml;enc;file;gif;gz;hlp;htm;html;image;iso;jar;java;jpeg;jpg;js;lua;m;mm;mov;mp3;mpg;odc;odf;odg;odi;odp;ods;odt;ogg;pdf;pgp;php;pl;png;ppt;ps;py;ram;rar;rb;rm;rpm;rtf;sig;sql;swf;sxc;sxd;sxi;sxw;tar;tex;tgz;txt;vcf;video;vsd;wav;wma;wmv;xls;xml;xpi;xvid;zip")
 #set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0))
 #set($filename = $doc.getFieldValue('resourcename'))
-#set($filetype = $mimeToExt.get($ct))
+
+#set($filetype = false)
+#set($filetype = $extMap.get($ct))
+##TODO: falling back to file extension is convenient, except when you don't have an icon for that extension
+##      example "application/vnd.openxmlformats-officedocument.wordprocessingml.document" document
+##        with a .docx extension.  It'd be nice to fall back to an "unknown" or the existing "file" type
+##      We sort of do this below, but only if the filename has no extension (anything after the last dot).
 #if(!$filetype)#set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1))#end
-#if(!$filetype)#set($filetype = "file")#end
-#if(!$supportedtypes.contains($filetype))#set($filetype = "file")#end
+##if(!$filetype)#set($filetype = "file")#end
+##if(!$supportedtypes.contains($filetype))#set($filetype = "file")#end
 <div class="result-title">
 ## Small file type icons from http://www.splitbrain.org/projects/file_icons (public domain)
 <img src="#{url_root}/img/filetypes/${filetype}.png" align="center">
@@ -29,7 +91,7 @@
 #if($ct) ($ct)#end
 </div>
 #if($doc.getFieldValue('author'))<div>Author: #field('author')</div>#end
-#if($doc.getFieldValue('last_modified'))<div>Last-modified: #field('last_modified')</div>#end
+#if($doc.getFieldValue('last_modified'))<div>last-modified: #field('last_modified')</div>#end
 <div class="result-body">#field('content')</div>
 <div class="mlt">
   #set($mlt = $mltResults.get($docId))

Added: lucene/dev/trunk/solr/licenses/velocity-1.7.jar.sha1
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/licenses/velocity-1.7.jar.sha1?rev=1426716&view=auto
==============================================================================
--- lucene/dev/trunk/solr/licenses/velocity-1.7.jar.sha1 (added)
+++ lucene/dev/trunk/solr/licenses/velocity-1.7.jar.sha1 Sat Dec 29 08:41:53 2012
@@ -0,0 +1 @@
+2ceb567b8f3f21118ecdec129fe1271dbc09aa7a