2 #macro(param $key)$request.params.get($key)#end
4 #macro(url_root)/solr#end
6 ## TODO: s/url_for_solr/url_for_core/ and s/url_root/url_for_solr/
7 #macro(core_name)$request.core.name#end
8 #macro(url_for_solr)#{url_root}#if($request.core.name != "")/$request.core.name#end#end
9 #macro(url_for_home)#url_for_solr/browse#end
11 #macro(q)&q=$!{esc.url($params.get('q'))}#end
13 #macro(fqs $p)#foreach($fq in $p)#if($velocityCount>1)&#{end}fq=$esc.url($fq)#end#end
15 #macro(debug)#if($request.params.get('debugQuery'))&debugQuery=true#end#end
17 #macro(boostPrice)#if($request.params.get('bf') == 'price')&bf=price#end#end
19 #macro(annotate)#if($request.params.get('annotateBrowse'))&annotateBrowse=true#end#end
21 #macro(annTitle $msg)#if($annotate == true)title="$msg"#end#end
23 #macro(spatial)#if($request.params.get('sfield'))&sfield=store#end#if($request.params.get('pt'))&pt=$request.params.get('pt')#end#if($request.params.get('d'))&d=$request.params.get('d')#end#end
25 #macro(qOpts)#set($queryOpts = $request.params.get("queryOpts"))#if($queryOpts && $queryOpts != "")&queryOpts=$queryOpts#end#end
27 #macro(group)#if($request.params.getBool("group") == true)&group=true#end#if($request.params.get("group.field"))#foreach($grp in $request.params.getParams('group.field'))&group.field=$grp#end#end#end
29 #macro(lensNoQ)?#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug#boostPrice#annotate#spatial#qOpts#group#end
30 #macro(lens)#lensNoQ#q#end
33 #macro(url_for_lens)#{url_for_home}#lens#end
35 #macro(url_for_start $start)#url_for_home#lens&start=$start#end
37 #macro(url_for_filters $p)#url_for_home?#q#boostPrice#spatial#qOpts#if($list.size($p) > 0)&#fqs($p)#end#debug#end
39 #macro(url_for_nested_facet_query $field)#url_for_home#lens&fq=$esc.url($field)#end
41 ## TODO: convert to use {!raw f=$field}$value (with escaping of course)
42 #macro(url_for_facet_filter $field $value)#url_for_home#lens&fq=$esc.url($field):%22$esc.url($value)%22#end
44 #macro(url_for_facet_date_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
46 #macro(url_for_facet_range_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
49 #macro(link_to_previous_page $text)
50 #if($page.current_page_number > 1)
51 #set($prev_start = $page.start - $page.results_per_page)
52 <a class="prev-page" href="#url_for_start($prev_start)">$text</a>
56 #macro(link_to_next_page $text)
57 #if($page.current_page_number < $page.page_count)
58 #set($next_start = $page.start + $page.results_per_page)
59 <a class="next-page" href="#url_for_start($next_start)">$text</a>
63 #macro(link_to_page $page_number $text)
64 #if($page_number == $page.current_page_number)
67 #if($page_number <= $page.page_count)
68 #set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
69 <a class="page" href="#url_for_start($page_start)">$text</a>
74 #macro(display_facet_query $field, $display, $fieldName)
75 #if($field.size() > 0)
76 <span class="facet-field">$display</span>
78 #foreach ($facet in $field)
79 #if ($facet.value > 0)
80 #set($facetURL = "#url_for_nested_facet_query($facet.key)")
82 <li><a href="$facetURL">$facet.key</a> ($facet.value)</li>
91 #macro(display_facet_range $field, $display, $fieldName, $start, $end, $gap, $before, $after)
92 <span class="facet-field">$display</span>
94 #if($before && $before != "")
95 #set($value = "[* TO " + "#format_value($start)" + "}")
96 #set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
97 <li><a href="$facetURL">Less than #format_value($start)</a> ($before)</li>
99 #foreach ($facet in $field)
100 #set($rangeEnd = "#range_get_to_value($facet.key, $gap)")
101 #set($value = "[" + $facet.key + " TO " + $rangeEnd + "}")
102 #set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
103 #if ($facetURL != '')
104 <li><a href="$facetURL">$facet.key - #format_value($rangeEnd)</a> ($facet.value)</li>
107 #if($end && $end != "" && $after > 0)
108 #set($value = "[" + "#format_value($end)" + " TO *}")
109 #set($facetURL = "#url_for_facet_range_filter($fieldName, $value)")
110 <li><a href="$facetURL">More than #format_value($end)</a> ($after)</li>
115 ## $pivots is a list of facet_pivot
116 #macro(display_facet_pivot $pivots, $display)
117 #if($pivots.size() > 0)
118 <span class="facet-field">$display</span>
120 #foreach ($pivot in $pivots)
121 #foreach ($entry in $pivot.value)
122 <a href="#url_for_facet_filter($entry.field, $entry.value)">$entry.field::$entry.value</a> ($entry.count)
124 #foreach($nest in $entry.pivot)
125 <a href="#url_for_facet_filter($entry.field, $entry.value)&fq=$esc.url($nest.field):%22$esc.url($nest.value)%22">$nest.field::$nest.value</a> ($nest.count)
135 #if($response.response.highlighting.get($docId).get($f).get(0))
137 #foreach($v in $response.response.highlighting.get($docId).get($f))
142 #foreach($v in $doc.getFieldValues($f))
148 #macro(utc_date $theDate)
149 $date.format("yyyy-MM-dd'T'HH:mm:ss'Z'",$theDate,$date.getLocale(),$date.getTimeZone().getTimeZone("UTC"))##
152 #macro(format_value $val)
153 #if(${val.class.name} == "java.util.Date")
160 #macro(range_get_to_value $inval, $gapval)
161 #if(${gapval.class.name} == "java.lang.String")
163 #elseif(${gapval.class.name} == "java.lang.Float" || ${inval.class.name} == "java.lang.Float")
164 $math.toDouble($math.add($inval,$gapval))##
166 $math.add($inval,$gapval)##