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 2013/01/12 12:57:03 UTC

svn commit: r1432410 - in /lucene/dev/branches/branch_4x: ./ dev-tools/ lucene/ lucene/analysis/ lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/ lucene/benchmark/ lucene/codecs/ lucene/core/ lucene/core/src/test/org/apache/l...

Author: ehatcher
Date: Sat Jan 12 11:57:01 2013
New Revision: 1432410

URL: http://svn.apache.org/viewvc?rev=1432410&view=rev
Log:
SOLR-3735: Relocate the example mime-to-extension mapping (merge from trunk)

Added:
    lucene/dev/branches/branch_4x/solr/licenses/velocity-1.7.jar.sha1   (props changed)
      - copied unchanged from r1426716, lucene/dev/trunk/solr/licenses/velocity-1.7.jar.sha1
Removed:
    lucene/dev/branches/branch_4x/solr/licenses/velocity-1.6.4.jar.sha1
Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/dev-tools/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/BUILD.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/MIGRATE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/README.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/SYSTEM_REQUIREMENTS.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java   (props changed)
    lucene/dev/branches/branch_4x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_4x/lucene/benchmark/   (props changed)
    lucene/dev/branches/branch_4x/lucene/build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/codecs/   (props changed)
    lucene/dev/branches/branch_4x/lucene/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.cfs.zip   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.nocfs.zip   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.cfs.zip   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.nocfs.zip   (props changed)
    lucene/dev/branches/branch_4x/lucene/demo/   (props changed)
    lucene/dev/branches/branch_4x/lucene/facet/   (props changed)
    lucene/dev/branches/branch_4x/lucene/grouping/   (props changed)
    lucene/dev/branches/branch_4x/lucene/highlighter/   (props changed)
    lucene/dev/branches/branch_4x/lucene/ivy-settings.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/join/   (props changed)
    lucene/dev/branches/branch_4x/lucene/licenses/   (props changed)
    lucene/dev/branches/branch_4x/lucene/memory/   (props changed)
    lucene/dev/branches/branch_4x/lucene/misc/   (props changed)
    lucene/dev/branches/branch_4x/lucene/module-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/queries/   (props changed)
    lucene/dev/branches/branch_4x/lucene/queryparser/   (props changed)
    lucene/dev/branches/branch_4x/lucene/sandbox/   (props changed)
    lucene/dev/branches/branch_4x/lucene/site/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/   (props changed)
    lucene/dev/branches/branch_4x/lucene/suggest/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/lucene/tools/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/README.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/SYSTEM_REQUIREMENTS.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/cloud-dev/   (props changed)
    lucene/dev/branches/branch_4x/solr/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/contrib/   (props changed)
    lucene/dev/branches/branch_4x/solr/contrib/velocity/ivy.xml
    lucene/dev/branches/branch_4x/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/example/   (props changed)
    lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/velocity/richtext-doc.vm
    lucene/dev/branches/branch_4x/solr/licenses/   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/scripts/   (props changed)
    lucene/dev/branches/branch_4x/solr/site/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/solr/testlogging.properties   (props changed)
    lucene/dev/branches/branch_4x/solr/webapp/   (props changed)

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1432410&r1=1432409&r2=1432410&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Sat Jan 12 11:57:01 2013
@@ -20,17 +20,13 @@ See the tutorial at http://lucene.apache
 
 $Id$
 
-==================  5.0.0 ==================
-
-(No changes)
-
 ==================  4.1.0 ==================
 
 Versions of Major Components
 ---------------------
 Apache Tika 1.2
 Carrot2 3.6.2
-Velocity 1.6.4 and Velocity Tools 2.0
+Velocity 1.7 and Velocity Tools 2.0
 Apache UIMA 2.3.1
 Apache ZooKeeper 3.4.5
 
@@ -565,6 +561,10 @@ Other Changes
 
 * SOLR-4208: ExtendedDismaxQParserPlugin has been refactored to make 
   subclassing easier. (Tomás Fernández Löbbe, hossman)
+  
+* SOLR-3735: Relocate the example mime-to-extension mapping, and
+  upgrade Velocity Engine to 1.7 (ehatcher)
+  
 
 ==================  4.0.0 ==================
 

Modified: lucene/dev/branches/branch_4x/solr/contrib/velocity/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/velocity/ivy.xml?rev=1432410&r1=1432409&r2=1432410&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/velocity/ivy.xml (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/velocity/ivy.xml Sat Jan 12 11:57:01 2013
@@ -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/branches/branch_4x/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java?rev=1432410&r1=1432409&r2=1432410&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java (original)
+++ lucene/dev/branches/branch_4x/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java Sat Jan 12 11:57:01 2013
@@ -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/branches/branch_4x/solr/example/solr/collection1/conf/velocity/richtext-doc.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/velocity/richtext-doc.vm?rev=1432410&r1=1432409&r2=1432410&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/velocity/richtext-doc.vm (original)
+++ lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/velocity/richtext-doc.vm Sat Jan 12 11:57:01 2013
@@ -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))