lr.solr-velocity.8.11.4.source-code._macros.vm Maven / Gradle / Ivy
The newest version!
#macro(param $key)$request.params.get($key)#end
#macro(url_root)/solr#end
#macro(core_name)$request.core.name#end
#macro(url_for_solr)#{url_root}#if($request.core.name != "")/$request.core.name#end#end
#macro(url_for_home)#url_for_solr$request.context.path#end
#macro(q)&q=$!{esc.url($request.params.get('q'))}#end
#macro(fqs $p)#foreach($fq in $p)#if($velocityCount>1){end}fq=$esc.url($fq)#end#end
#macro(debug)#if($debug)&debug=true#end#end
#macro(sort $p)#if($p)#foreach($s in $p)&sort=$esc.url($s)#end#end#end
#macro(lensNoQ)?#if($request.params.getParams('fq') and $request.params.getParams('fq').size() > 0)fqs($request.params.getParams('fq'))#end#sort($request.params.getParams('sort'))#debug#end
#macro(lens)#lensNoQ#q#end
#macro(url_for_lens)#{url_for_home}#lens#end
#macro(url_for_start $start)#url_for_home#lens&start=$start#end
#macro(url_for_filters $p)#url_for_home?#q#if($p.size() > 0)fqs($p)#end#debug#end
#macro(url_for_nested_facet_query $field)#url_for_home#lens&fq=$esc.url($field)#end
#macro(url_for_facet_filter $field $value)#url_for_home#lens&fq=#if($value!=$null)$esc.url($field):%22$esc.url($value)%22#else-$esc.url($field):[*+TO+*]#end#end
#macro(url_for_facet_date_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
#macro(url_for_facet_range_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
# TODO: make this parameterized fully, no context sensitivity
#macro(field $f)
#if($response.response.highlighting.get($docId).get($f).get(0))
#set($pad = "")
#foreach($v in $response.response.highlighting.get($docId).get($f))
$pad$v## #TODO: $esc.html() or maybe make that optional?
#set($pad = " ... ")
#end
#else
$esc.html($display.list($doc.getFieldValues($f), ", "))
#end
#end
#macro(link_to_previous_page)
#if($page.current_page_number > 1)
#set($prev_start = $page.start - $page.results_per_page)
$resource.previous
#end
#end
#macro(link_to_next_page)
#if($page.current_page_number < $page.page_count)
#set($next_start = $page.start + $page.results_per_page)
$resource.next
#end
#end
#macro(link_to_page $page_number $text)
#if($page_number == $page.current_page_number)
$text
#else
#if($page_number <= $page.page_count)
#set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
$text
#end
#end
#end