You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gs...@apache.org on 2011/03/02 16:48:58 UTC

svn commit: r1076266 - in /lucene/dev/branches/branch_3x: ./ lucene/ solr/ solr/example/exampledocs/ solr/example/solr/conf/ solr/example/solr/conf/velocity/

Author: gsingers
Date: Wed Mar  2 15:48:58 2011
New Revision: 1076266

URL: http://svn.apache.org/viewvc?rev=1076266&view=rev
Log:
SOLR-2178: 3.x backport

Added:
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/query.vm
      - copied unchanged from r1026129, lucene/dev/trunk/solr/example/solr/conf/velocity/query.vm
Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/example/exampledocs/hd.xml
    lucene/dev/branches/branch_3x/solr/example/exampledocs/ipod_video.xml
    lucene/dev/branches/branch_3x/solr/example/exampledocs/mem.xml
    lucene/dev/branches/branch_3x/solr/example/exampledocs/monitor.xml
    lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/VM_global_library.vm
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/browse.vm
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/footer.vm
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/hit.vm
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/layout.vm
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/main.css

Modified: lucene/dev/branches/branch_3x/solr/example/exampledocs/hd.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/exampledocs/hd.xml?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/exampledocs/hd.xml (original)
+++ lucene/dev/branches/branch_3x/solr/example/exampledocs/hd.xml Wed Mar  2 15:48:58 2011
@@ -28,7 +28,8 @@
   <field name="popularity">6</field>
   <field name="inStock">true</field>
   <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
-  <field name="store">45.17614,-93.87341</field>
+  <!-- Near Oklahoma city -->
+  <field name="store">35.0752,-97.032</field>
 </doc>
 
 <doc>

Modified: lucene/dev/branches/branch_3x/solr/example/exampledocs/ipod_video.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/exampledocs/ipod_video.xml?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/exampledocs/ipod_video.xml (original)
+++ lucene/dev/branches/branch_3x/solr/example/exampledocs/ipod_video.xml Wed Mar  2 15:48:58 2011
@@ -32,7 +32,7 @@
   <field name="price">399.00</field>
   <field name="popularity">10</field>
   <field name="inStock">true</field>
-  <!-- San Francisco store -->
-  <field name="store">37.7752,-122.4232</field>
+  <!-- Dodge City store -->
+  <field name="store">37.7752,-100.0232</field>
   <field name="manufacturedate_dt">2005-10-12T08:00:00Z</field>
 </doc></add>

Modified: lucene/dev/branches/branch_3x/solr/example/exampledocs/mem.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/exampledocs/mem.xml?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/exampledocs/mem.xml (original)
+++ lucene/dev/branches/branch_3x/solr/example/exampledocs/mem.xml Wed Mar  2 15:48:58 2011
@@ -43,8 +43,8 @@
   <field name="price">74.99</field>
   <field name="popularity">7</field>
   <field name="inStock">true</field>
-  <!-- San Francisco store -->
-  <field name="store">37.7752,-122.4232</field>
+  <!-- Dodge City store -->
+  <field name="store">37.7752,-100.0232</field>
   <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
 
   <field name="payloads">electronics|4.0 memory|2.0</field>

Modified: lucene/dev/branches/branch_3x/solr/example/exampledocs/monitor.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/exampledocs/monitor.xml?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/exampledocs/monitor.xml (original)
+++ lucene/dev/branches/branch_3x/solr/example/exampledocs/monitor.xml Wed Mar  2 15:48:58 2011
@@ -28,6 +28,6 @@
   <field name="popularity">6</field>
   <field name="inStock">true</field>
   <!-- Buffalo store -->
-  <field name="store">45.17614,-93.87341</field>
+  <field name="store">43.17614,-90.57341</field>
 </doc></add>
 

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml Wed Mar  2 15:48:58 2011
@@ -779,10 +779,15 @@
        <str name="v.layout">layout</str>
        <str name="title">Solritas</str>
 
-       <str name="defType">dismax</str>
+       <str name="defType">edismax</str>
        <str name="q.alt">*:*</str>
        <str name="rows">10</str>
        <str name="fl">*,score</str>
+       <str name="mlt.qf">
+         text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
+       </str>
+       <str name="mlt.fl">text,features,name,sku,id,manu,cat</str>
+       <int name="mlt.count">3</int>
 
        <str name="qf">
           text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/VM_global_library.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/VM_global_library.vm?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/VM_global_library.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/VM_global_library.vm Wed Mar  2 15:48:58 2011
@@ -4,7 +4,7 @@
 #macro(url_for_solr)/solr#if($request.core.name != "")/$request.core.name#end#end
 #macro(url_for_home)#url_for_solr/browse#end
 
-#macro(q)q=$!{esc.url($params.get('q'))}#end
+#macro(q)&q=$!{esc.url($params.get('q'))}#end
 
 #macro(fqs $p)#foreach($fq in $p)#if($velocityCount>1)&#{end}fq=$esc.url($fq)#end#end
 
@@ -14,15 +14,18 @@
 
 #macro(annotate)#if($request.params.get('annotateBrowse'))&annotateBrowse=true#end#end
 
-#macro(annTitle $msg)#if($annotate == true)title="$msg"#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#annotate#end
+#macro(spatial)#if($request.params.get('sfield'))&sfield=store#end#if($request.params.get('pt'))&pt=$request.params.get('pt')#end#if($request.params.get('d'))&d=$request.params.get('d')#end#end        
+
+#macro(lensNoQ)?#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug#boostPrice#annotate#spatial#end
+#macro(lens)#lensNoQ#q#end
 
 #macro(url_for_lens)#{url_for_home}#lens#end
 
 #macro(url_for_start $start)#url_for_home#lens&start=$start#end
 
-#macro(url_for_filters $p)#url_for_home?#q#if($list.size($p) > 0)&#fqs($p)#end#debug#end
+#macro(url_for_filters $p)#url_for_home?#q#boostPrice#spatial#if($list.size($p) > 0)&#fqs($p)#end#debug#end
 
 #macro(url_for_nested_facet_query $field)#url_for_home#lens&fq=$esc.url($field)#end
 

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/browse.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/browse.vm?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/browse.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/browse.vm Wed Mar  2 15:48:58 2011
@@ -1,33 +1,9 @@
 #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">
-    <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" #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
-    <div class="constraints">
-      #foreach($fq in $params.getParams('fq'))
-        #set($previous_fq_count=$velocityCount - 1)
-      &gt; <a style="{text-decoration: line-through;}" href="#url_for_filters($request.params.getParams('fq').subList(0,$previous_fq_count))">$fq</a>
-      #end
-    </div>
-     #if($request.params.get('debugQuery'))
-        <a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle parsed query</a>
-        <pre style="display:none">$response.response.debug.parsedquery</pre>
-      #end    
-  </form>
-</div>
-
+#set($mltResults = $response.response.get("moreLikeThis"))
+#set($annotate = $params.get("annotateBrowse"))
+#parse('query.vm')
 #if($response.response.spellcheck.suggestions and $response.response.spellcheck.suggestions.size() > 0)
   Did you mean <a href="#url_for_home?q=$esc.url($response.response.spellcheck.suggestions.collation)#if($list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug">$response.response.spellcheck.suggestions.collation</a>?
 #end

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/footer.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/footer.vm?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/footer.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/footer.vm Wed Mar  2 15:48:58 2011
@@ -1,16 +1,17 @@
 <hr/>
-Generated by <a href="http://wiki.apache.org/solr/VelocityResponseWriter">VelocityResponseWriter</a>
-
-#if($request.params.get('debugQuery'))
+<div>
+  <span>Options:</span>
+  #if($request.params.get('debugQuery'))
   <a href="#url_for_home?#q#if($list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end">disable debug</a>
-#else
+  #else
   <a href="#url_for_lens&debugQuery=true">enable debug</a>
-#end
-#if($annotate)
+  #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
+  #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
+  #end
+  <a #annTitle("Click to switch to an XML response: &wt=xml") href="#url_for_lens&wt=xml#if($request.params.get('debugQuery'))&debugQuery=true#end">XML</a></div>
+<div>Generated by <a href="http://wiki.apache.org/solr/VelocityResponseWriter">VelocityResponseWriter</a></div>
+<div><span>Documentation: </span> <a href="http://lucene.apache.org/solr">Solr Home Page</a>, <a href="http://wiki.apache.org/solr">Solr Wiki</a></div>
+<div>Disclaimer: The locations displayed in this demonstration are purely fictional.  It is more than likely that no store with the items listed actually exists at that location!</div>        
\ No newline at end of file

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/hit.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/hit.vm?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/hit.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/hit.vm Wed Mar  2 15:48:58 2011
@@ -1,6 +1,7 @@
+#set($docId = $doc.getFieldValue('id'))
 #macro(field $f)
-  #if($response.response.highlighting.get($doc.getFieldValue('id')).get($f).get(0))
-    $!response.response.highlighting.get($doc.getFieldValue('id')).get($f).get(0)
+  #if($response.response.highlighting.get($docId).get($f).get(0))
+    $!response.response.highlighting.get($docId).get($f).get(0)
   #else
     #foreach($v in $doc.getFieldValues($f))
       $v
@@ -8,11 +9,31 @@
   #end
 #end
 <div class="result-document">
-  <p><b>#field('name')</b></p>
-  <p>Price: $!number.currency($doc.getFieldValue('price'))</p>
-  <p>Features: #field('features')</p>
-  <p>In Stock: #field('inStock')</p>
-  
+  <div class="result-title"><b>#field('name')</b><span class="mlt">#if($params.getBool('mlt', false) == false)<a href="#lensNoQ&q=id:$docId&mlt=true">More Like This</a>#end</span></div>
+  ##do we have a physical store for this product
+  #set($store = $doc.getFieldValue('store'))
+  #if($store)<div class="map"><img src="http://maps.google.com/maps/api/staticmap?&zoom=12&size=150x80&maptype=roadmap&markers=$doc.getFieldValue('store')&sensor=false" /><div><small><a target="_map" href="http://maps.google.com/?q=$store&amp;source=embed">Larger Map</a></small></div></div>#end
+  <div>Price: $!number.currency($doc.getFieldValue('price'))</div>
+  <div>Features: #field('features')</div>
+  <div>In Stock: #field('inStock')</div>
+  <div class="mlt">
+    #set($mlt = $mltResults.get($docId))
+    #set($mltOn = $params.getBool('mlt'))
+    #if($mltOn == true)<div class="field-name">Similar Items</div>#end
+    #if ($mltOn && $mlt && $mlt.size() > 0)
+    <ul>
+      #foreach($mltHit in $mlt)
+        #set($mltId = $mltHit.getFieldValue('id'))
+        <li><div><a href="#url_for_home?q=id:$mltId">$mltId</a></div><div><span class="field-name">Name:</span> $mltHit.getFieldValue('name')</div>
+          <div><span class="field-name">Price:</span> $!number.currency($mltHit.getFieldValue('price')) <span class="field-name">In Stock:</span> $mltHit.getFieldValue('inStock')</div>
+
+        </li>
+      #end
+    </ul>
+    #elseif($mltOn && $mlt.size() == 0)
+      <div>No Similar Items Found</div>
+    #end
+  </div>
   #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>

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/layout.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/layout.vm?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/layout.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/layout.vm Wed Mar  2 15:48:58 2011
@@ -25,6 +25,7 @@
 
       // http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=i&terms.sort=count
     });
+  
     </script>
 
   </head>

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/main.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/main.css?rev=1076266&r1=1076265&r2=1076266&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/main.css (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/main.css Wed Mar  2 15:48:58 2011
@@ -89,6 +89,8 @@ a {
   width: 80%;
 }
 
+
+
 .query-box, .constraints {
   padding: 5px;
   margin: 5px;
@@ -111,7 +113,7 @@ a {
 }
 
 .query-boost {
-  width: 20%;
+  
   top: 10px;
   left: 50px;
   position: relative;
@@ -147,6 +149,24 @@ a {
   margin-bottom: 15px;
 }
 
+.result-document div{
+  padding: 5px;
+}
+
+.result-title{
+  width:60%;
+}
+
+.mlt{
+  
+}
+
+.map{
+  float: right;
+  position: relative;
+  top: -25px;  
+}
+
 .result-document:nth-child(2n+1) {
   background-color: #eee;
 }