aboutsummaryrefslogtreecommitdiff
path: root/solr-8.3.1/example/files/conf/velocity/hit.vm
blob: 2c658cdd954bd6c39546872dfa6ba3462871ec1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#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 = $doc.getFirstValue('content_type').split(";").get(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>