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/02/04 06:44:10 UTC
svn commit: r503361 - in /lucene/solr/trunk/client/ruby/flare:
app/controllers/ app/views/browse/ app/views/layouts/ app/views/simile/
config/ public/stylesheets/
Author: ehatcher
Date: Sat Feb 3 21:44:09 2007
New Revision: 503361
URL: http://svn.apache.org/viewvc?view=rev&rev=503361
Log:
SIMILE Exhibit support (prototype) - Tada!
Also started adding some CSS.
Added:
lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb (with props)
lucene/solr/trunk/client/ruby/flare/app/views/simile/
lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml
lucene/solr/trunk/client/ruby/flare/public/stylesheets/flare.css
Modified:
lucene/solr/trunk/client/ruby/flare/app/controllers/application.rb
lucene/solr/trunk/client/ruby/flare/app/controllers/browse_controller.rb
lucene/solr/trunk/client/ruby/flare/app/views/browse/facet.rhtml
lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml
lucene/solr/trunk/client/ruby/flare/app/views/layouts/browse.rhtml
lucene/solr/trunk/client/ruby/flare/config/routes.rb
Modified: lucene/solr/trunk/client/ruby/flare/app/controllers/application.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/controllers/application.rb?view=diff&rev=503361&r1=503360&r2=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/controllers/application.rb (original)
+++ lucene/solr/trunk/client/ruby/flare/app/controllers/application.rb Sat Feb 3 21:44:09 2007
@@ -7,4 +7,21 @@
class ApplicationController < ActionController::Base
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_flare_session_id'
+
+
+ def query
+ queries = session[:queries]
+ if queries.nil? || queries.empty?
+ query = "[* TO *]"
+ else
+ query = session[:queries].collect{|q| "#{q[:negative] ? '-' : ''}(#{q[:query]})"}.join(' AND ')
+ end
+
+ query
+ end
+
+ def filters
+ session[:filters].collect {|filter| "#{filter[:negative] ? '-' : ''}#{filter[:field]}:\"#{filter[:value]}\""}
+ end
+
end
Modified: lucene/solr/trunk/client/ruby/flare/app/controllers/browse_controller.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/controllers/browse_controller.rb?view=diff&rev=503361&r1=503360&r2=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/controllers/browse_controller.rb (original)
+++ lucene/solr/trunk/client/ruby/flare/app/controllers/browse_controller.rb Sat Feb 3 21:44:09 2007
@@ -18,7 +18,7 @@
end
def facet
- @facets = retrieve_field_facets("#{params[:field]}")
+ @facets = retrieve_field_facets(params[:field_name])
end
def auto_complete_for_search_query
@@ -57,7 +57,7 @@
end
def add_filter
- session[:filters] << {:field => params[:field], :value => params[:value]}
+ session[:filters] << {:field => params[:field_name], :value => params[:value]}
redirect_to :action => 'index'
end
@@ -88,18 +88,4 @@
results.field_facets(field)
end
- def query
- queries = session[:queries]
- if queries.nil? || queries.empty?
- query = "[* TO *]"
- else
- query = session[:queries].collect{|q| "#{q[:negative] ? '-' : ''}(#{q[:query]})"}.join(' AND ')
- end
-
- query
- end
-
- def filters
- session[:filters].collect {|filter| "#{filter[:negative] ? '-' : ''}#{filter[:field]}:\"#{filter[:value]}\""}
- end
end
Added: lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb?view=auto&rev=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb (added)
+++ lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb Sat Feb 3 21:44:09 2007
@@ -0,0 +1,32 @@
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+class SimileController < ApplicationController
+ def exhibit
+ @info = SOLR.send(Solr::Request::IndexInfo.new) # TODO move this call to only have it called when the index may have changed
+ @facet_fields = @info.field_names.find_all {|v| v =~ /_facet$/}
+
+ # TODO Add paging and sorting
+ req = Solr::Request::Standard.new :query => query,
+ :filter_queries => filters,
+ :facets => {:fields => @facet_fields, :limit => 20 , :mincount => 1, :sort => :count, :debug_query=>true}
+ @data = SOLR.send(req)
+ @data.each {|d| d['label'] = d['title_text']}
+
+ respond_to do |format|
+ puts "format = #{format.inspect}"
+ format.html # renders index.rhtml
+ format.json { render :json => {'items' => @data}.to_json }
+ end
+ end
+end
Propchange: lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb
------------------------------------------------------------------------------
svn:executable = *
Modified: lucene/solr/trunk/client/ruby/flare/app/views/browse/facet.rhtml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/views/browse/facet.rhtml?view=diff&rev=503361&r1=503360&r2=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/browse/facet.rhtml (original)
+++ lucene/solr/trunk/client/ruby/flare/app/views/browse/facet.rhtml Sat Feb 3 21:44:09 2007
@@ -1,3 +1,3 @@
<% @facets.each do |value,count| %>
- <%= link_to value, :action => 'add_filter', :field => @field, :value => value %> (<%=count%>)
+ <%= link_to value, :action => 'add_filter', :field_name => params[:field_name], :value => value %> (<%=count%>)
<% 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=503361&r1=503360&r2=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml (original)
+++ lucene/solr/trunk/client/ruby/flare/app/views/browse/index.rhtml Sat Feb 3 21:44:09 2007
@@ -23,14 +23,17 @@
</ul>
</div>
<h2>facets</h2>
-<div>
+
+
+<div class="boxContent">
+
<% @facet_fields.each do |field|%>
-<div>
- <%=field%>:
+ <h4><%=field%></h4>
+ <ul>
<% @response.field_facets(field).each do |k,v| %>
- <%= link_to "#{k} (#{v})", :action => 'add_filter', :field=>field, :value=>k%>
- <% end %> <%=link_to "more...", :action => 'facet', :field => field%>
-</div>
+ <li><%= link_to "#{k} (#{v})", :action => 'add_filter', :field_name=>field, :value=>k%></li>
+ <% end %> <li><%=link_to "more...", :action => 'facet', :field_name => field%></li>
+ </ul>
<% end %>
</div>
<h2>results</h2>
Modified: lucene/solr/trunk/client/ruby/flare/app/views/layouts/browse.rhtml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/views/layouts/browse.rhtml?view=diff&rev=503361&r1=503360&r2=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/layouts/browse.rhtml (original)
+++ lucene/solr/trunk/client/ruby/flare/app/views/layouts/browse.rhtml Sat Feb 3 21:44:09 2007
@@ -2,6 +2,7 @@
<head>
<title>Flare: <%=controller.action_name%></title>
<%= javascript_include_tag :defaults %>
+ <%= stylesheet_link_tag 'flare'%>
</head>
<body>
<%= yield %>
Added: 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=auto&rev=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml (added)
+++ lucene/solr/trunk/client/ruby/flare/app/views/simile/exhibit.rhtml Sat Feb 3 21:44:09 2007
@@ -0,0 +1,30 @@
+<html>
+ <head>
+ <title>MIT Nobel Prize Winners</title>
+
+ <link href="exhibit.json" type="application/json" rel="exhibit/data" />
+
+ <script src="http://static.simile.mit.edu/exhibit/api/exhibit-api.js"
+ type="text/javascript"></script>
+
+ <style>
+ body {
+ margin: 1in;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>SIMILE Exhibit view</h1>
+ <table width="100%">
+ <tr valign="top">
+ <td>
+ <div id="exhibit-control-panel"></div>
+ <div id="exhibit-view-panel"></div>
+ </td>
+ <td width="25%">
+ <div id="exhibit-browse-panel" ex:facets=".medium_facet, .country_facet, .signed_facet, .rating_facet, .language_facet, .genre_facet"></div>
+ </td>
+ </tr>
+ </table>
+ </body>
+ </html>
\ No newline at end of file
Modified: lucene/solr/trunk/client/ruby/flare/config/routes.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/config/routes.rb?view=diff&rev=503361&r1=503360&r2=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/config/routes.rb (original)
+++ lucene/solr/trunk/client/ruby/flare/config/routes.rb Sat Feb 3 21:44:09 2007
@@ -21,5 +21,6 @@
# Install the default route as the lowest priority.
# map.connect ':controller/:action/:id.:format'
+ map.connect ':controller/:action.:format'
map.connect ':controller/:action'
end
Added: lucene/solr/trunk/client/ruby/flare/public/stylesheets/flare.css
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/public/stylesheets/flare.css?view=auto&rev=503361
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/public/stylesheets/flare.css (added)
+++ lucene/solr/trunk/client/ruby/flare/public/stylesheets/flare.css Sat Feb 3 21:44:09 2007
@@ -0,0 +1,149 @@
+body {
+ font-family: Verdana, Geneva, Arial, helvetica, sans-serif;
+ font-size: 13px;
+ margin: 0px;
+}
+
+td {
+ font-family: Verdana, Geneva, Arial, helvetica, sans-serif;
+ font-size: 13px;
+}
+a, a:visited {
+ color: #000099;
+ text-decoration: none;
+}
+a:hover {
+ color: #0000CC;
+ text-decoration: underline;
+}
+
+#search {
+ background-color: #EFEFDE;
+ padding-top: 30px;
+ padding-left: 30px;
+ padding-bottom: 20px;
+ margin-bottom: 20px;
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ border-bottom-color: #CCCCCC;
+}
+#sidebar {
+ float: right;
+ width: 339px;
+ font-size:90%;
+ line-height: 18px;
+ margin-left: 20px;
+ margin-bottom: 20px;
+}
+
+#results {
+ margin-right: 380px;
+}
+
+.resultsPager {
+ padding: 4px;
+ margin-top: 30px;
+ margin-bottom: 20px;
+ border: 1px solid #A2C9EF;
+ background-color: #E4F1FD;
+}
+
+/* SIDE BAR */
+
+.box {
+ width:339px;
+ background:#F3F3F3 url(../images/hits_bot.gif) no-repeat left bottom;
+ margin-bottom: 20px;
+ padding:0 0 6px;
+ color:#333;
+ line-height:1.5em;
+}
+.box2 {
+ width:100%;
+ background:url(../images/hits_top.gif) no-repeat left top;
+ padding:6px 0 0;
+}
+.box3 {
+ background:url(../images/hits_rails.gif) repeat-y;
+ padding:0px;
+}
+.boxContent {
+ padding-left: 15px;
+ padding-right: 15px;
+ padding-bottom: 15px;
+}
+.box p {
+ margin:0 0 .6em;
+}
+.sidebar-title {
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+ margin:0;
+ padding:0 0 .2em;
+ border-bottom:1px dotted #fa0;
+ font-size:115%;
+ line-height:1.5em;
+ color:#333;
+}
+
+
+
+.recordAmazon {
+ margin-left: 150px;
+}
+.recordAuthor {
+ margin-top: 10px;
+}
+.recordBasic {
+ margin-left: 150px;
+}
+.recordBookJacket {
+ float: left;
+ margin-right: 20px;
+}
+.recordFullText {
+ margin: 30px;
+ padding: 10px;
+}
+.recordHoldings {
+ background-color: #EFEFEF;
+ margin: 10px;
+ padding: 10px;
+ border: 1px solid #CCCCCC;
+}
+.recordHoldingHead {
+ border-bottom-style: solid;
+ border-bottom-color: #CCCCCC;
+ border-bottom-width: 1px;
+ margin-bottom: 10px;
+ padding: 5px;
+ text-align: left;
+}
+.recordHoldingBody {
+ background-color: #EFEFEF;
+ padding: 5px;
+ padding-right: 10px;
+}
+.recordImprint {
+ margin-top: 10px;
+}
+.recordTitle {
+ font-size: 18px;
+ font-weight: bold;
+}
+.home {
+ clear: both;
+ width: 640px;
+ margin: 0 auto;
+}
+.homeSearch {
+ margin-top: 80px;
+ margin-bottom: 20px;
+ background-color: #EFEFDE;
+ padding-top: 30px;
+ padding-left: 30px;
+ padding-bottom: 20px;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #CCCCCC;
+}
+