Skip to content

Apache Lucene open-source search software

SOLR-2178: more movement towards tutorial status: added tool tip annotations, called out the facet types more distinctly, added a link to the Solr Admin

Grant Ingersoll408e18b10c3a
diff --git a/solr/example/solr/conf/velocity/VM_global_library.vm b/solr/example/solr/conf/velocity/VM_global_library.vm
index efcaee259be..a42f4c51c76 100644
--- a/solr/example/solr/conf/velocity/VM_global_library.vm
+++ b/solr/example/solr/conf/velocity/VM_global_library.vm
@@ -1,3 +1,4 @@
+
#macro(param $key)$request.params.get($key)#end
#macro(url_for_solr)/solr#if($request.core.name != "")/$request.core.name#end#end
@@ -9,9 +10,13 @@
#macro(debug)#if($request.params.get('debugQuery'))&debugQuery=true#end#end
-#macro(boostPrice)#if($request.params.get('bf') == 'price')CHECKED#end#end
+#macro(boostPrice)#if($request.params.get('bf') == 'price')&bf=price#end#end
+
+#macro(annotate)#if($request.params.get('annotateBrowse'))&annotateBrowse=true#end#end
+
+#macro(annTitle $msg)#if($annotate == true)title="$msg"#end#end
-#macro(lens)?#q#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug#if($request.params.get('bf') == 'price')&bf=price#end#end
+#macro(lens)?#q#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug#if($request.params.get('bf') == 'price')&bf=price#end#annotate#end
#macro(url_for_lens)#{url_for_home}#lens#end
diff --git a/solr/example/solr/conf/velocity/browse.vm b/solr/example/solr/conf/velocity/browse.vm
index 013770c4cde..ce7f233b2d9 100644
--- a/solr/example/solr/conf/velocity/browse.vm
+++ b/solr/example/solr/conf/velocity/browse.vm
@@ -1,16 +1,17 @@
#set($searcher=$request.searcher)
#set($params=$request.params)
#set($clusters = $response.response.clusters)
-
+#set($annotate = $request.params.get("annotateBrowse"))
<div class="query-box">
<form id="query-form" action="#{url_for_home}" method="GET">
- <a href="#url_for_home#if($request.params.get('debugQuery'))?debugQuery=true#end"><img src="#{url_for_solr}/admin/solr_small.png" id="logo"/></a>
-
<div class="inputs"><span>Find: <input type="text" id="q" name="q" value="$!esc.html($params.get('q'))"/> <input type="submit"/> <input type="reset"/></span>
- <div class="query-boost"><input type="checkbox" name="bf" value="price" #boostPrice>Boost by Price</input> </div></div>
+ <div class="query-boost"><input type="checkbox" name="bf" #annTitle("Add the boost function &bf=price to the query") value="price" #if($request.params.get('bf') == 'price')checked="true"#end>Boost by Price</input> </div></div>
#if($request.params.get('debugQuery'))
<input type="hidden" name="debugQuery" value="true"/>
#end
+ #if($annotate == true)
+ <input type="hidden" name="annotateBrowse" value="true"/>
+ #end
#foreach($fq in $request.params.getParams('fq'))
<input type="hidden" name="fq" value="$esc.html($fq)"/>
#end
diff --git a/solr/example/solr/conf/velocity/facet_dates.vm b/solr/example/solr/conf/velocity/facet_dates.vm
index d2757663c94..5fd2151256c 100644
--- a/solr/example/solr/conf/velocity/facet_dates.vm
+++ b/solr/example/solr/conf/velocity/facet_dates.vm
@@ -1,4 +1,5 @@
##TODO: Generically deal with all dates
+<h2 #annTitle("Facets generated by adding &facet.date= to the request")>Date Facets</h2>
#set($field = $response.response.facet_counts.facet_dates.manufacturedate_dt)
#set($gap = $response.response.facet_counts.facet_dates.manufacturedate_dt.gap)
#display_facet_date($field, "Manufacture Date", "manufacturedate_dt", $gap)
diff --git a/solr/example/solr/conf/velocity/facet_fields.vm b/solr/example/solr/conf/velocity/facet_fields.vm
new file mode 100644
index 00000000000..91c50be16be
--- /dev/null
+++ b/solr/example/solr/conf/velocity/facet_fields.vm
@@ -0,0 +1,12 @@
+#if($response.facetFields)
+ <h2 #annTitle("Facets generated by adding &facet.field= to the request")>Field Facets</h2>
+ #foreach($field in $response.facetFields)
+ <span class="facet-field">$field.name</span>
+
+ <ul>
+ #foreach($facet in $field.values)
+ <li><a href="#url_for_facet_filter($field.name, $facet.name)">$facet.name</a> ($facet.count)</li>
+ #end
+ </ul>
+ #end
+ #end
\ No newline at end of file
diff --git a/solr/example/solr/conf/velocity/facet_pivot.vm b/solr/example/solr/conf/velocity/facet_pivot.vm
index 1dbf5744d53..5e1e151d724 100644
--- a/solr/example/solr/conf/velocity/facet_pivot.vm
+++ b/solr/example/solr/conf/velocity/facet_pivot.vm
@@ -1,2 +1,3 @@
+<h2 #annTitle("Facets generated by adding &facet.pivot= to the request")>Pivot Facets</h2>
#set($pivot = $response.response.facet_counts.facet_pivot)
-#display_facet_pivot($pivot, "Pivots")
+#display_facet_pivot($pivot, "")
diff --git a/solr/example/solr/conf/velocity/facet_queries.vm b/solr/example/solr/conf/velocity/facet_queries.vm
index 93116d39b1f..2ac65d64cb7 100644
--- a/solr/example/solr/conf/velocity/facet_queries.vm
+++ b/solr/example/solr/conf/velocity/facet_queries.vm
@@ -1,2 +1,3 @@
#set($field = $response.response.facet_counts.facet_queries)
-#display_facet_query($field, "Facet Queries", "")
\ No newline at end of file
+<h2 #annTitle("Facets generated by adding &facet.query= to the request")>Query Facets</h2>
+#display_facet_query($field, "", "")
\ No newline at end of file
diff --git a/solr/example/solr/conf/velocity/facet_ranges.vm b/solr/example/solr/conf/velocity/facet_ranges.vm
index b5fcd4ccf2c..a5e9b56e573 100644
--- a/solr/example/solr/conf/velocity/facet_ranges.vm
+++ b/solr/example/solr/conf/velocity/facet_ranges.vm
@@ -1,3 +1,4 @@
+<h2 #annTitle("Facets generated by adding &facet.range= to the request")>Range Facets</h2>
#set($field = $response.response.facet_counts.facet_ranges.price.counts)
#set($start = $response.response.facet_counts.facet_ranges.price.start)
#set($end = $response.response.facet_counts.facet_ranges.price.end)
diff --git a/solr/example/solr/conf/velocity/facets.vm b/solr/example/solr/conf/velocity/facets.vm
index 5c2355b9904..cba4bf7b841 100644
--- a/solr/example/solr/conf/velocity/facets.vm
+++ b/solr/example/solr/conf/velocity/facets.vm
@@ -1,15 +1,4 @@
- #if($response.facetFields)
- <h2>Facets</h2>
- #foreach($field in $response.facetFields)
- <span class="facet-field">$field.name</span>
-
- <ul>
- #foreach($facet in $field.values)
- <li><a href="#url_for_facet_filter($field.name, $facet.name)">$facet.name</a> ($facet.count)</li>
- #end
- </ul>
- #end
- #end
+#parse('facet_fields.vm')
#parse('facet_queries.vm')
#parse('facet_ranges.vm')
#parse('facet_dates.vm')
diff --git a/solr/example/solr/conf/velocity/footer.vm b/solr/example/solr/conf/velocity/footer.vm
index 7597dba4830..77b7bd84a18 100644
--- a/solr/example/solr/conf/velocity/footer.vm
+++ b/solr/example/solr/conf/velocity/footer.vm
@@ -6,5 +6,11 @@ Generated by <a href="http://wiki.apache.org/solr/VelocityResponseWriter">Veloci
#else
<a href="#url_for_lens&debugQuery=true">enable debug</a>
#end
+#if($annotate)
+ <a href="#url_for_home?#q#if($list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#boostPrice">disable annotation</a>
+#else
+ <a href="#url_for_lens&annotateBrowse=true">enable annotation</a>
+#end
+
<a href="#url_for_lens&wt=xml#if($request.params.get('debugQuery'))&debugQuery=true#end">XML</a>
\ No newline at end of file
diff --git a/solr/example/solr/conf/velocity/header.vm b/solr/example/solr/conf/velocity/header.vm
index 067f77745e8..15c3870a052 100644
--- a/solr/example/solr/conf/velocity/header.vm
+++ b/solr/example/solr/conf/velocity/header.vm
@@ -1 +1,3 @@
-## empty header, customize as desired
\ No newline at end of file
+<div id="head">
+ <span ><a href="#url_for_home#if($request.params.get('debugQuery'))?debugQuery=true#end"><img src="#{url_for_solr}/admin/solr_small.png" id="logo"/></a></span>
+</div>
\ No newline at end of file
diff --git a/solr/example/solr/conf/velocity/layout.vm b/solr/example/solr/conf/velocity/layout.vm
index abece9ce1c3..fc912d03128 100644
--- a/solr/example/solr/conf/velocity/layout.vm
+++ b/solr/example/solr/conf/velocity/layout.vm
@@ -29,6 +29,7 @@
</head>
<body>
+ <div id="admin"><a href="#url_for_solr/admin">Solr Admin</a></div>
<div id="header">
#parse("header.vm")
</div>
diff --git a/solr/example/solr/conf/velocity/main.css b/solr/example/solr/conf/velocity/main.css
index 992d8743482..351f340e56f 100644
--- a/solr/example/solr/conf/velocity/main.css
+++ b/solr/example/solr/conf/velocity/main.css
@@ -1,3 +1,11 @@
+#admin{
+ text-align: right;
+ vertical-align: top;
+}
+
+#head{
+ width: 100%;
+}
.array-field {
border: 2px solid #474747;
background: #FFE9D8;
@@ -73,15 +81,14 @@ a {
background: white;
}
-#logo {
- margin: 10px;
- border-style: none;
-}
-
.constraints {
margin-top: 10px;
}
+#query-form{
+ width: 80%;
+}
+
.query-box, .constraints {
padding: 5px;
margin: 5px;
@@ -100,8 +107,7 @@ a {
}
.query-box {
- top: -35px;
- position: relative;
+
}
.query-boost {
@@ -116,12 +122,12 @@ a {
left: 180px;
top: -20px;
position: relative;
+
}
#logo {
- top: 35px;
- position: relative;
- margin-right: 50px;
+ margin: 10px;
+ border-style: none;
}
.pagination {