From 24cc3d9bce54abf332df476e2cddcc3b53cc123c Mon Sep 17 00:00:00 2001 From: Erik Hatcher Date: Mon, 15 Dec 2008 19:41:35 +0000 Subject: [PATCH] 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 --- contrib/velocity/src/main/java/footer.vm | 7 +- .../src/main/solr/conf/velocity/browse.vm | 109 +++++++++--------- .../src/main/solr/conf/velocity/debug.vm | 9 ++ .../src/main/solr/conf/velocity/hit.vm | 14 +-- 4 files changed, 70 insertions(+), 69 deletions(-) create mode 100644 contrib/velocity/src/main/solr/conf/velocity/debug.vm diff --git a/contrib/velocity/src/main/java/footer.vm b/contrib/velocity/src/main/java/footer.vm index d4b8b444908..cedb297f835 100644 --- a/contrib/velocity/src/main/java/footer.vm +++ b/contrib/velocity/src/main/java/footer.vm @@ -1,9 +1,6 @@ #if($params.getBool("debugQuery",false)) -
-  request = $request
-
-  response = $response.values
-
+ #parse("debug.vm") #end +
Generated by VelocityResponseWriter \ No newline at end of file diff --git a/contrib/velocity/src/main/solr/conf/velocity/browse.vm b/contrib/velocity/src/main/solr/conf/velocity/browse.vm index 9c1b4e11489..17687bdc4d9 100644 --- a/contrib/velocity/src/main/solr/conf/velocity/browse.vm +++ b/contrib/velocity/src/main/solr/conf/velocity/browse.vm @@ -1,70 +1,67 @@ -#set($doclist=$response.values.response) #set($searcher=$request.searcher) #set($params=$request.params) -#set($fields=$response.returnFields) -## TODO: Implement layouts - - #param('title') - - - - - + + #param('title') + + + + + -
- #parse("header.vm") +
+ #parse("header.vm") - #set($filter_queries = $params.getParams('fq')) - #foreach($fq in $filter_queries) - > $fq - #end -
+ #set($filter_queries = $params.getParams('fq')) + #foreach($fq in $filter_queries) + > $fq + #end +
-
-
- Query: -
-
+
+
+ Query: +
+
-
- #foreach($field in $response.values.facet_counts.facet_fields) - $field.key - - #end -
+ +
+ #foreach($field in $response.facetFields) + $field.name + + #end +
- + -
- #foreach($id in $doclist.iterator()) - #set($doc = $searcher.doc($id,$response.returnFields)) - #parse("hit.vm") - #end -
+
+ #foreach($doc in $response.results) + #parse("hit.vm") + #end +
- -
- #parse("footer.vm") -
+
+ #parse("footer.vm") +
- + \ No newline at end of file diff --git a/contrib/velocity/src/main/solr/conf/velocity/debug.vm b/contrib/velocity/src/main/solr/conf/velocity/debug.vm new file mode 100644 index 00000000000..91e110e79b9 --- /dev/null +++ b/contrib/velocity/src/main/solr/conf/velocity/debug.vm @@ -0,0 +1,9 @@ +

REQUEST

+
+$esc.html($request) +
+ +

RESPONSE

+
+$esc.html($response) +
diff --git a/contrib/velocity/src/main/solr/conf/velocity/hit.vm b/contrib/velocity/src/main/solr/conf/velocity/hit.vm index 34c884dd501..2f31f22503f 100644 --- a/contrib/velocity/src/main/solr/conf/velocity/hit.vm +++ b/contrib/velocity/src/main/solr/conf/velocity/hit.vm @@ -1,18 +1,16 @@
- #foreach($field in $doc.fields) - #if($response.returnFields.contains("*") || $response.returnFields.contains($field.name())) + #foreach($fieldname in $doc.fieldNames)

- $field.name() : + $fieldname : - ##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

- #end #end #if($params.getBool("debugQuery",false)) - toggle explain
$response.values.debug.explain.get($doc.get('id'))
+ toggle explain +
$response.getExplainMap().get($doc.getFirstValue('id'))
#end