You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by eh...@apache.org on 2007/03/16 21:21:04 UTC

svn commit: r519127 - in /lucene/solr/trunk/client/ruby/flare: app/helpers/application_helper.rb app/views/browse/index.rhtml app/views/simile/exhibit.rhtml app/views/simile/timeline.rxml config/environment.rb lib/flare_context.rb

Author: ehatcher
Date: Fri Mar 16 13:21:02 2007
New Revision: 519127

URL: http://svn.apache.org/viewvc?view=rev&rev=519127
Log:
humanize facet labels, more config work

Modified:
    lucene/solr/trunk/client/ruby/flare/app/helpers/application_helper.rb
    lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml
    lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml
    lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml
    lucene/solr/trunk/client/ruby/flare/config/environment.rb
    lucene/solr/trunk/client/ruby/flare/lib/flare_context.rb

Modified: lucene/solr/trunk/client/ruby/flare/app/helpers/application_helper.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/helpers/application_helper.rb?view=diff&rev=519127&r1=519126&r2=519127
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/helpers/application_helper.rb (original)
+++ lucene/solr/trunk/client/ruby/flare/app/helpers/application_helper.rb Fri Mar 16 13:21:02 2007
@@ -3,4 +3,7 @@
 
 # Methods added to this helper will be available to all templates in the application.
 module ApplicationHelper
+  def facet_label(field)
+     field.match(/(.*)_.*/)[1].humanize.downcase
+  end
 end

Modified: lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml?view=diff&rev=519127&r1=519126&r2=519127
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml (original)
+++ lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml Fri Mar 16 13:21:02 2007
@@ -7,6 +7,7 @@
 	</div>
 <!-- <h2>browse facets</h2> -->
 
+<% if @flare.facet_queries.size > 0%>
 <h4>
   saved searches
 </h4>
@@ -22,10 +23,10 @@
 </li>
 <% end %>
 </ul>
-
+<% end %>
 <% @flare.facet_fields.each do |field|%>
   <h4> 
-<%=h field%> <%=link_to "[browse]", :action => 'facet', :field => field%> 
+<%= facet_label(field)%> <%=link_to "[browse]", :action => 'facet', :field => field%> 
 <!-- <%=link_to field, :action => 'facet', :field => field%> -->
 </h4> 
 

Modified: lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml?view=diff&rev=519127&r1=519126&r2=519127
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml (original)
+++ lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml Fri Mar 16 13:21:02 2007
@@ -16,7 +16,7 @@
                 <div id="exhibit-view-panel"></div>
             </td>
             <td width="25%">
-                <div id="exhibit-browse-panel" ex:facets="<%= SOLR_CONFIG[:exhibit_facets] -%>"></div>
+                <div id="exhibit-browse-panel" ex:facets="<%= @flare.facet_fields.collect {|f| ".#{f}"}.join(',') -%>"></div>
             </td>
         </tr>
     </table>

Modified: lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml?view=diff&rev=519127&r1=519126&r2=519127
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml (original)
+++ lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml Fri Mar 16 13:21:02 2007
@@ -15,7 +15,8 @@
     xml.event(doc['title_text'],
       :start => doc[SOLR_CONFIG[:timeline_dates].to_s],
       :end => doc[SOLR_CONFIG[:timeline_dates].to_s],
-      :title => doc['title_text'])
+      :title => doc['title_text'],
+      :image => SOLR_CONFIG[:image_proc] ? SOLR_CONFIG[:image_proc].call(doc) : nil)
   end
 end
 

Modified: lucene/solr/trunk/client/ruby/flare/config/environment.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/config/environment.rb?view=diff&rev=519127&r1=519126&r2=519127
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/config/environment.rb (original)
+++ lucene/solr/trunk/client/ruby/flare/config/environment.rb Fri Mar 16 13:21:02 2007
@@ -67,9 +67,8 @@
   },
 
   :delicious => {
-#    :image_url => Proc.new {|d| "http://images.amazon.com/images/P/#{d[:asin_text]}.01.MZZZZZZZ"},
     :timeline_dates => :published_year_facet,
-    :exhibit_facets => ".medium_facet, .country_facet, .signed_facet, .rating_facet, .language_facet, .genre_facet, .publisher_facet, .published_year_facet"
+    :image_proc => Proc.new {|doc| "http://images.amazon.com/images/P/#{doc['asin_text']}.01.MZZZZZZZ"}
   },
 
   :tang => {
@@ -77,12 +76,12 @@
   
   :marc => {
     :timeline_dates => :year_facet,
-    :exhibit_facets => ".subject_genre_facet, .subject_era_facet, .subject_topic_facet, .subject_geographic_facet, .year_facet"
   },
   
   # TODO: :uva could inherit :marc settings, only overriding the template for VIRGO links
   :uva => {
-    :timeline_dates => :year_facet
+    :timeline_dates => :year_facet,
+    :facets_exclude => [:filename_facet]
   },
 }
 SOLR_ENV = ENV["SOLR_ENV"] || "development"

Modified: lucene/solr/trunk/client/ruby/flare/lib/flare_context.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/lib/flare_context.rb?view=diff&rev=519127&r1=519126&r2=519127
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/lib/flare_context.rb (original)
+++ lucene/solr/trunk/client/ruby/flare/lib/flare_context.rb Fri Mar 16 13:21:02 2007
@@ -16,27 +16,29 @@
   attr_reader :facet_fields, :text_fields
 
   def initialize(solr_config)
-    @connection = Solr::Connection.new(solr_config[:solr_url])
+    @solr_config = solr_config
+    @connection = Solr::Connection.new(@solr_config[:solr_url])
 
     clear
     @facet_queries = {}  # name => {:queries => [], :filters => []}
     
-    puts "initialize\n-------","#{solr_config.inspect}"
     @index_info = @connection.send(Solr::Request::IndexInfo.new)
+    
+    excluded =  @solr_config[:facets_exclude] ? @solr_config[:facets_exclude].collect {|e| e.to_s} : []
+    @facet_fields =  @index_info.field_names.find_all {|v| v =~ /_facet$/} - excluded
 
-    @facet_fields = @index_info.field_names.find_all {|v| v =~ /_facet$/}
     @text_fields = @index_info.field_names.find_all {|v| v =~ /_text$/}
   end
   
   def clear
-    puts "clear\n-------"
     @queries = []
     @filters = []
     @applied_facet_queries = []
 
     # this is cleared for development purposes - allowing flare to stay running but different Solr datasets swapping
     @index_info = @connection.send(Solr::Request::IndexInfo.new)
-    @facet_fields = @index_info.field_names.find_all {|v| v =~ /_facet$/}
+    excluded =  @solr_config[:facets_exclude] ? @solr_config[:facets_exclude].collect {|e| e.to_s} : []
+    @facet_fields =  @index_info.field_names.find_all {|v| v =~ /_facet$/} - excluded
     @text_fields = @index_info.field_names.find_all {|v| v =~ /_text$/}
     
     # facet_queries not cleared as their lifetime is different than constraints