lucene/solr/example/files/conf/velocity/hit.vm

78 lines
2.1 KiB
Plaintext

#set($docId = $doc.getFirstValue($request.schema.uniqueKeyField.name))
## Load Mime-Type List and Mapping
#parse('mime_type_lists.vm')
## Title
#if($doc.getFieldValue('title'))
#set($title = $esc.html($doc.getFirstValue('title')))
#else
#set($title = "$doc.getFirstValue('id').substring($math.add(1,$doc.getFirstValue('id').lastIndexOf('/')))")
#end
## Date
#if($doc.getFieldValue('attr_meta_creation_date'))
#set($date = $esc.html($doc.getFirstValue('attr_meta_creation_date')))
#else
#set($date = "No date found")
#end
## URL
#if($doc.getFieldValue('url'))
#set($url = $doc.getFieldValue('url'))
#elseif($doc.getFieldValue('resourcename'))
#set($url = "file:///$doc.getFirstValue('resourcename')")
#else
#set($url = "$doc.getFieldValue('id')")
#end
## Sort out Mime-Type
#set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0))
#set($filename = $doc.getFirstValue('resourcename'))
#set($filetype = false)
#set($filetype = $mimeExtensionsMap.get($ct))
#if(!$filetype)
#set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1))
#end
#if(!$filetype)
#set($filetype = "file")
#end
#if(!$supportedMimeTypes.contains($filetype))
#set($filetype = "file")
#end
<div class="result-document">
<span class="result-title">
<img src="#{url_root}/img/filetypes/${filetype}.png" align="center">
<b>$title</b>
</span>
<div>
id: $docId </br>
</div>
#set($pad = "")
#foreach($v in $response.response.highlighting.get($docId).get("content"))
$pad$esc.html($v).replace("HL_START","<em>").replace("HL_END","</em>")
#set($pad = " ... ")
#end
</div>
<a href="#" class="debug" onclick='jQuery(this).next().toggle(); return false;'>toggle explain</a>
<pre style="display: none;">
$esc.html($response.getExplainMap().get($doc.getFirstValue('id')))
</pre>
<a href="#" class="debug" onclick='jQuery(this).next().toggle(); return false;'>show all fields</a>
<pre style="display:none;">
#foreach($fieldname in $doc.fieldNames)
<span>$fieldname :</span>
<span>#foreach($value in $doc.getFieldValues($fieldname))$esc.html($value)#end</span>
#end
</pre>