From bf9cde01f1c78716813cd62dcb4e4b243c35a801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Tue, 6 Sep 2011 12:55:42 +0000 Subject: [PATCH] SOLR-2741 Bugs in facet range display in trunk Also removes promotion of deprecated facet.date from example git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1165648 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 4 +- solr/example/solr/conf/solrconfig.xml | 27 ++++--- .../solr/conf/velocity/VM_global_library.vm | 79 ++++++------------- .../example/solr/conf/velocity/facet_dates.vm | 9 --- .../solr/conf/velocity/facet_ranges.vm | 2 +- solr/example/solr/conf/velocity/facets.vm | 8 +- 6 files changed, 46 insertions(+), 83 deletions(-) delete mode 100644 solr/example/solr/conf/velocity/facet_dates.vm diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index f41044ea4c3..5bcbaf2bf51 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -62,7 +62,7 @@ Detailed Change List New Features ---------------------- - + * SOLR-571: The autowarmCount for LRUCaches (LRUCache and FastLRUCache) now supports "percentages" which get evaluated relative the current size of the cache when warming happens. @@ -200,6 +200,8 @@ Optimizations Bug Fixes ---------------------- +* SOLR-2741: Bugs in facet range display in trunk (janhoy) + * SOLR-1908: Fixed SignatureUpdateProcessor to fail to initialize on invalid config. Specifically: a signatureField that does not exist, or overwriteDupes=true with a signatureField that is not indexed. diff --git a/solr/example/solr/conf/solrconfig.xml b/solr/example/solr/conf/solrconfig.xml index cce0eedbf78..794392e3397 100755 --- a/solr/example/solr/conf/solrconfig.xml +++ b/solr/example/solr/conf/solrconfig.xml @@ -815,20 +815,21 @@ GB 1 cat,inStock - price - 0 - 600 - 50 - popularity - 3 after - manufacturedate_dt - NOW/YEAR-10YEARS - NOW - 1 - +1YEAR - before - after + price + 0 + 600 + 50 + popularity + 0 + 10 + 3 + manufacturedate_dt + NOW/YEAR-10YEARS + NOW + +1YEAR + before + after on diff --git a/solr/example/solr/conf/velocity/VM_global_library.vm b/solr/example/solr/conf/velocity/VM_global_library.vm index 3d33b512055..0756ab8dc03 100644 --- a/solr/example/solr/conf/velocity/VM_global_library.vm +++ b/solr/example/solr/conf/velocity/VM_global_library.vm @@ -83,76 +83,31 @@ #end #end -#macro(display_facet_date $field, $display, $fieldName, $gap) - $display - -#end - - #macro(display_facet_range $field, $display, $fieldName, $start, $end, $gap, $before, $after) $display #end -## -## -## -## cat -## electronics -## 17 -## -## -## inStock -## true -## 13 -## -## -## inStock -## false -## 4 -## -## -## - ## $pivots is a list of facet_pivot #macro(display_facet_pivot $pivots, $display) #if($pivots.size() > 0) @@ -182,6 +137,24 @@ #end #end -#macro(capitalize $name) - ${name.substring(0,1).toUpperCase()}${name.substring(1)} +#macro(utc_date $theDate) +$date.format("yyyy-MM-dd'T'HH:mm:ss'Z'",$theDate,$date.getLocale(),$date.getTimeZone().getTimeZone("UTC"))## +#end + +#macro(format_value $val) +#if(${val.class.name} == "java.util.Date") +#utc_date($val)## +#else +$val## +#end +#end + +#macro(range_get_to_value $inval, $gapval) +#if(${gapval.class.name} == "java.lang.String") +$inval$gapval## +#elseif(${gapval.class.name} == "java.lang.Float" || ${inval.class.name} == "java.lang.Float") +$math.toDouble($math.add($inval,$gapval))## +#else +$math.add($inval,$gapval)## +#end #end \ No newline at end of file diff --git a/solr/example/solr/conf/velocity/facet_dates.vm b/solr/example/solr/conf/velocity/facet_dates.vm deleted file mode 100644 index 5835212a1bb..00000000000 --- a/solr/example/solr/conf/velocity/facet_dates.vm +++ /dev/null @@ -1,9 +0,0 @@ -##TODO: Generically deal with all dates -

Date Facets

-#foreach ($field in $response.response.facet_counts.facet_dates) - #set($name = $field.key) - #set($display = "#capitalize($name)") - #set($f = $field.value) - #set($gap = $field.value.gap) - #display_facet_date($f, $display, $name, $gap) -#end \ 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 66804019590..0118fe0bf71 100644 --- a/solr/example/solr/conf/velocity/facet_ranges.vm +++ b/solr/example/solr/conf/velocity/facet_ranges.vm @@ -1,7 +1,7 @@

Range Facets

#foreach ($field in $response.response.facet_counts.facet_ranges) #set($name = $field.key) - #set($display = "#capitalize($name)") + #set($display = $name) #set($f = $field.value.counts) #set($start = $field.value.start) #set($end = $field.value.end) diff --git a/solr/example/solr/conf/velocity/facets.vm b/solr/example/solr/conf/velocity/facets.vm index 4dfde9ed2d5..fd5f5d98172 100644 --- a/solr/example/solr/conf/velocity/facets.vm +++ b/solr/example/solr/conf/velocity/facets.vm @@ -1,9 +1,5 @@ -#parse('facet_fields.vm') +#parse('facet_fields.vm') #parse('facet_queries.vm') #parse('facet_ranges.vm') -#parse('facet_dates.vm') #parse('facet_pivot.vm') -#parse('cluster.vm') - - - +#parse('cluster.vm') \ No newline at end of file