Skip to content

Commit

Permalink
simple improvements to fields in hit display for authors and titles
Browse files Browse the repository at this point in the history
  • Loading branch information
hossman committed Mar 21, 2011
1 parent 9eb2f09 commit 5d0c369
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/isfdb-solr-home/conf/solrconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/solr/conf/solrconf
</requestHandler>

<!-- a basic velocity powered UI -->
<requestHandler name="/isfdb" class="solr.SearchHandler">
<requestHandler name="/browse" class="solr.SearchHandler">
<lst name="defaults">
<str name="v.template">browse</str>
<str name="v.layout">layout</str>
Expand Down
30 changes: 0 additions & 30 deletions src/isfdb-solr-home/conf/velocity/doc.vm

This file was deleted.

17 changes: 17 additions & 0 deletions src/isfdb-solr-home/conf/velocity/doc_author.vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="result-title">
Author: <b>#field('canonical_name')</b>
#if($doc.containsKey('real_author_id'))<i>Psuedonym</i>#end
</div>

#if($doc.containsKey('birth_place'))<div>Birth Place: #field('birth_place')</div>#end
#if($doc.containsKey('real_canonical_name'))<div>Real Name: #field('real_canonical_name')</div>#end

#if ($doc.containsKey('pseudonym_names'))
<div>Pseudonyms:
<ul>
#foreach($name in $doc.getFieldValues('pseudonym_names'))
<li>$name</li>
#end
</ul>
</div>
#end
18 changes: 18 additions & 0 deletions src/isfdb-solr-home/conf/velocity/doc_title.vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="result-title">
Title: <b>#field('title')</b> <i>#field('ttype')</i>
</div>

#if($doc.containsKey('rating'))<div>Rating: #field('rating')</div>#end
#if (1 == $doc.getFieldValues('author_names').size())
<div>Author: #field('author_names')</div>
#end
#if (1 < $doc.getFieldValues('author_names').size())
<div>Authors:
<ul>
#foreach($name in $doc.getFieldValues('author_names'))
<li>$name</li>
#end
</ul>
</div>
#end

13 changes: 12 additions & 1 deletion src/isfdb-solr-home/conf/velocity/hit.vm
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#set($docId = $doc.getFieldValue('id'))
#set($docType = $doc.getFieldValue('doc_type'))

<div class="result-document">
#parse("doc.vm")
#if($docType == 'TITLE')
#parse("doc_title.vm")
#end
#if($docType == 'AUTHOR')
#parse("doc_author.vm")
#end

#if($params.getBool("debugQuery",false))
<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>

0 comments on commit 5d0c369

Please sign in to comment.