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)) #if($params.getBool("debugQuery",false))
<pre> #parse("debug.vm")
request = $request
response = $response.values
</pre>
#end #end
<hr/>
Generated by <a href="http://wiki.apache.org/solr/VelocityResponseWriter">VelocityResponseWriter</a> 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($searcher=$request.searcher)
#set($params=$request.params) #set($params=$request.params)
#set($fields=$response.returnFields)
<html> <html>
## TODO: Implement layouts
<head> <head>
<title>#param('title')</title> <title>#param('title')</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
@ -27,14 +24,15 @@
</form> </form>
</div> </div>
<div class="facet-fields"> <div class="facet-fields">
#foreach($field in $response.values.facet_counts.facet_fields) #foreach($field in $response.facetFields)
<span class="facet-field">$field.key</span> <span class="facet-field">$field.name</span>
<ul> <ul>
#foreach($facet in $field.value) #foreach($facet in $field.values)
#set($facetURL = "#url_for_nested_facet($field.key, $facet.key)") #set($facetURL = "#url_for_nested_facet($field.name, $facet.name)")
#if ($facetURL != '') #if ($facetURL != '')
<li><a href="$facetURL">$facet.key</a> ($facet.value)</li> <li><a href="$facetURL">$facet.name</a> ($facet.count)</li>
#end #end
#end #end
</ul> </ul>
@ -46,8 +44,7 @@
</div> </div>
<div class="results"> <div class="results">
#foreach($id in $doclist.iterator()) #foreach($doc in $response.results)
#set($doc = $searcher.doc($id,$response.returnFields))
#parse("hit.vm") #parse("hit.vm")
#end #end
</div> </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"> <div class="result-document">
#foreach($field in $doc.fields) #foreach($fieldname in $doc.fieldNames)
#if($response.returnFields.contains("*") || $response.returnFields.contains($field.name()))
<p> <p>
<span class="field-name">$field.name() :</span> <span class="field-name">$fieldname :</span>
<span> <span>
##TODO: Need to provide helpers for field values, including HTML escaping and highlighting #foreach($value in $doc.getFieldValues($fieldname))
#foreach($value in $doc.getFieldables($field.name())) $value
$request.schema.getFieldType($field.name()).toExternal($value)
#end #end
</span> </span>
</p> </p>
#end #end
#end
#if($params.getBool("debugQuery",false)) #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 #end
</div> </div>