SOLR-3711: Truncate long strings in /browse field facets

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1648041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2014-12-27 10:11:06 +00:00
parent 4a7385bc29
commit 9159eede8f
3 changed files with 8 additions and 1 deletions

View File

@ -567,6 +567,8 @@ Other Changes
* SOLR-6855: bin/solr -e dih launches, but has some path cruft issues preventing some of the * SOLR-6855: bin/solr -e dih launches, but has some path cruft issues preventing some of the
imports don't work (Hossman, Timothy Potter) imports don't work (Hossman, Timothy Potter)
* SOLR-3711: Truncate long strings in /browse field facets (ehatcher)
================== 4.10.3 ================== ================== 4.10.3 ==================
Bug Fixes Bug Fixes

View File

@ -35,6 +35,7 @@ import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.tools.generic.ComparisonDateTool; import org.apache.velocity.tools.generic.ComparisonDateTool;
import org.apache.velocity.tools.generic.DisplayTool;
import org.apache.velocity.tools.generic.EscapeTool; import org.apache.velocity.tools.generic.EscapeTool;
import org.apache.velocity.tools.generic.ListTool; import org.apache.velocity.tools.generic.ListTool;
import org.apache.velocity.tools.generic.MathTool; import org.apache.velocity.tools.generic.MathTool;
@ -87,6 +88,7 @@ public class VelocityResponseWriter implements QueryResponseWriter {
context.put("math", new MathTool()); context.put("math", new MathTool());
context.put("number", new NumberTool()); context.put("number", new NumberTool());
context.put("sort", new SortTool()); context.put("sort", new SortTool());
context.put("display", new DisplayTool());
context.put("engine", engine); // for $engine.resourceExists(...) context.put("engine", engine); // for $engine.resourceExists(...)

View File

@ -13,7 +13,10 @@
<span class="facet-field">$field.name</span> <span class="facet-field">$field.name</span>
<ul> <ul>
#foreach($facet in $field.values) #foreach($facet in $field.values)
<li><a href="#url_for_facet_filter($field.name, $facet.name)">#if($facet.name!=$null)$facet.name#else<em>missing</em>#end</a> ($facet.count)</li> <li>
<a href="#url_for_facet_filter($field.name, $facet.name)" title="$esc.html($facet.name)">
#if($facet.name!=$null)$esc.html($display.truncate($facet.name,20))#else<em>missing</em>#end</a> ($facet.count)
</li>
#end #end
</ul> </ul>
#end ## end if > 0 #end ## end if > 0