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

svn commit: r1078650 - in /lucene/dev/branches/branch_3x/solr/example/solr/conf: solrconfig.xml velocity/VM_global_library.vm velocity/facet_dates.vm velocity/facet_ranges.vm velocity/facets.vm

Author: yonik
Date: Mon Mar  7 01:48:48 2011
New Revision: 1078650

URL: http://svn.apache.org/viewvc?rev=1078650&view=rev
Log:
SOLR-2405: solrconfig.xml tweaks: add DIH lib & remove facet.date

Modified:
    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/facet_dates.vm
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_ranges.vm
    lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facets.vm

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=1078650&r1=1078649&r2=1078650&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 Mon Mar  7 01:48:48 2011
@@ -74,6 +74,8 @@
     -->
   <lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
   <lib dir="../../dist/" regex="apache-solr-clustering-\d.*\.jar" />
+  <lib dir="../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
+
   <!-- If a dir option (with or without a regex) is used and nothing
        is found that matches, it will be ignored
     -->
@@ -759,8 +761,8 @@
       -->
     </requestHandler>
 
-  <!-- A Robust Example 
-       
+  <!-- A Robust Example
+
        This example SearchHandler declaration shows off usage of the
        SearchHandler with many defaults declared
 
@@ -801,17 +803,16 @@
        <str name="facet.mincount">1</str>
        <str name="facet.pivot">cat,inStock</str>
        <str name="facet.range">price</str>
-       <int name="facet.range.start">0</int>
-       <int name="facet.range.end">600</int>
-       <int name="facet.range.gap">50</int>
-       <str name="facet.range.other">after</str>
-       <str name="facet.date">manufacturedate_dt</str>
-       <str name="facet.date.start">NOW/YEAR-10YEARS</str>
-       <str name="facet.date.end">NOW</str>
-       <str name="facet.mincount">1</str>
-       <str name="facet.date.gap">+1YEAR</str>
-       <str name="facet.date.other">before</str>
-       <str name="facet.date.other">after</str>
+       <int name="f.price.facet.range.start">0</int>
+       <int name="f.price.facet.range.end">600</int>
+       <int name="f.price.facet.range.gap">50</int>
+       <str name="f.price.facet.range.other">after</str>
+       <str name="facet.range">manufacturedate_dt</str>
+       <str name="f.manufacturedate_dt.facet.range.start">NOW/YEAR-10YEARS</str>
+       <str name="f.manufacturedate_dt.facet.range.end">NOW</str>
+       <str name="f.manufacturedate_dt.facet.range.gap">+1YEAR</str>
+       <str name="f.manufacturedate_dt.facet.range.other">before</str>
+       <str name="f.manufacturedate_dt.facet.range.other">after</str>
 
 
        <!-- Highlighting defaults -->

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=1078650&r1=1078649&r2=1078650&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 Mon Mar  7 01:48:48 2011
@@ -81,27 +81,30 @@
   #end      
 #end
 
-#macro(display_facet_date $field, $display, $fieldName, $gap)
+#macro(display_facet_range_date $field, $display, $fieldName)
   <span class="facet-field">$display</span>
+    ##Note: even if mincount is 1, you can still get a '0' before & after
+    ##Note: We assume facet.range.include='lower'
     <ul>
-    #foreach ($facet in $field)
+    #if ($field.before && $field.before > 0)
+      #set($value = "[* TO " + $date.format("yyyy-MM-dd'T'HH:mm:ss'Z'", $field.start) + "-1MILLIS]")
+      #set($facetURL = "#url_for_facet_date_filter($fieldName, $value)")
+      <li><a href="$facetURL">Before</a> ($field.before)</li>
+    #end
+    #foreach ($facet in $field.counts)
       #set($theDate = $date.toDate("yyyy-MM-dd'T'HH:mm:ss'Z'", $facet.key))
-      #set($value = '["' + $facet.key + '" TO "' + $facet.key + $gap + '"]')
+      #set($value = '["' + $facet.key + '" TO "' + $facet.key + $field.gap + '-1MILLIS"]')
 
       #set($facetURL = "#url_for_facet_date_filter($fieldName, $value)")
       #if ($facetURL != '')
-        #if ($facet.key != "gap" && $facet.key != "start" && $facet.key != "end" && $facet.key != "before" && $facet.key != "after")
-
           <li><a href="$facetURL">$date.format('MMM yyyy', $theDate)</a> ($facet.value)</li>
-        #end
-        #if ($facet.key == "before" && $facet.value > 0)
-          <li><a href="$facetURL">Before</a> ($facet.value)</li>
-        #end
-        #if ($facet.key == "after" && $facet.value > 0)
-          <li><a href="$facetURL">After</a> ($facet.value)</li>
-        #end
       #end
     #end
+    #if ($field.after && $field.after > 0)
+      #set($value = "[" + $date.format("yyyy-MM-dd'T'HH:mm:ss'Z'", $field.after) + " TO *]")
+      #set($facetURL = "#url_for_facet_date_filter($fieldName, $value)")
+      <li><a href="$facetURL">After</a> ($field.after)</li>
+    #end
     </ul>
 #end
         

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_dates.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_dates.vm?rev=1078650&r1=1078649&r2=1078650&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_dates.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_dates.vm Mon Mar  7 01:48:48 2011
@@ -1,5 +0,0 @@
-##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)

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_ranges.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_ranges.vm?rev=1078650&r1=1078649&r2=1078650&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_ranges.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facet_ranges.vm Mon Mar  7 01:48:48 2011
@@ -25,3 +25,6 @@
 ##TODO: Make this display the "range", not just the lower value
 ##TODO: Have a generic way to deal with ranges
 #display_facet_range($field, "Price (in $)", "price", $start, $end, $gap, $before, $after)
+
+#set($field = $response.response.facet_counts.facet_ranges.manufacturedate_dt)
+#display_facet_range_date($field, "Manufacture Date", "manufacturedate_dt")
\ No newline at end of file

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facets.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facets.vm?rev=1078650&r1=1078649&r2=1078650&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facets.vm (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/velocity/facets.vm Mon Mar  7 01:48:48 2011
@@ -1,7 +1,6 @@
 #parse('facet_fields.vm')  
 #parse('facet_queries.vm')
 #parse('facet_ranges.vm')
-#parse('facet_dates.vm')
 #parse('cluster.vm')