Convert templates to using new QueryResponse response object

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@726780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2008-12-15 19:41:35 +00:00
parent ebba8adb5c
commit 24cc3d9bce
4 changed files with 70 additions and 69 deletions

View File

@ -1,9 +1,6 @@
#if($params.getBool("debugQuery",false))
<pre>
request = $request
response = $response.values
</pre>
#parse("debug.vm")
#end
<hr/>
Generated by <a href="http://wiki.apache.org/solr/VelocityResponseWriter">VelocityResponseWriter</a>

View File

@ -1,9 +1,6 @@
#set($doclist=$response.values.response)
#set($searcher=$request.searcher)
#set($params=$request.params)
#set($fields=$response.returnFields)
<html>
## TODO: Implement layouts
<head>
<title>#param('title')</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
@ -27,14 +24,15 @@
</form>
</div>
<div class="facet-fields">
#foreach($field in $response.values.facet_counts.facet_fields)
<span class="facet-field">$field.key</span>
#foreach($field in $response.facetFields)
<span class="facet-field">$field.name</span>
<ul>
#foreach($facet in $field.value)
#set($facetURL = "#url_for_nested_facet($field.key, $facet.key)")
#foreach($facet in $field.values)
#set($facetURL = "#url_for_nested_facet($field.name, $facet.name)")
#if ($facetURL != '')
<li><a href="$facetURL">$facet.key</a> ($facet.value)</li>
<li><a href="$facetURL">$facet.name</a> ($facet.count)</li>
#end
#end
</ul>
@ -46,8 +44,7 @@
</div>
<div class="results">
#foreach($id in $doclist.iterator())
#set($doc = $searcher.doc($id,$response.returnFields))
#foreach($doc in $response.results)
#parse("hit.vm")
#end
</div>

View File

@ -0,0 +1,9 @@
<h1>REQUEST</h1>
<div>
$esc.html($request)
</div>
<h1>RESPONSE</h1>
<div>
$esc.html($response)
</div>

View File

@ -1,18 +1,16 @@
<div class="result-document">
#foreach($field in $doc.fields)
#if($response.returnFields.contains("*") || $response.returnFields.contains($field.name()))
#foreach($fieldname in $doc.fieldNames)
<p>
<span class="field-name">$field.name() :</span>
<span class="field-name">$fieldname :</span>
<span>
##TODO: Need to provide helpers for field values, including HTML escaping and highlighting
#foreach($value in $doc.getFieldables($field.name()))
$request.schema.getFieldType($field.name()).toExternal($value)
#foreach($value in $doc.getFieldValues($fieldname))
$value
#end
</span>
</p>
#end
#end
#if($params.getBool("debugQuery",false))
<a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle explain</a> <pre style="display:none">$response.values.debug.explain.get($doc.get('id'))</pre>
<a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle explain</a>
<pre style="display:none">$response.getExplainMap().get($doc.getFirstValue('id'))</pre>
#end
</div>