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/12 15:20:18 UTC

svn commit: r506457 - in /lucene/solr/trunk/client/ruby/flare/app: controllers/simile_controller.rb views/simile/timeline.rhtml views/simile/timeline.rxml

Author: ehatcher
Date: Mon Feb 12 06:20:17 2007
New Revision: 506457

URL: http://svn.apache.org/viewvc?view=rev&rev=506457
Log:
Add SIMILE Timeline view, currently specific to the Delicious Library dataset

Added:
    lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rhtml   (with props)
    lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml   (with props)
Modified:
    lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb

Modified: 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=diff&rev=506457&r1=506456&r2=506457
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb (original)
+++ lucene/solr/trunk/client/ruby/flare/app/controllers/simile_controller.rb Mon Feb 12 06:20:17 2007
@@ -32,4 +32,23 @@
       format.json { render :json => {'items' => @data}.to_json } # Exhibit seems to require data to be in a 'items' Hash
     end                                         
   end
+  
+  def timeline
+    # TODO this code was copied from BrowseController#index, and is here only as a quick and dirty prototype.
+    # TODO figuring out where these calls cleanly belong is the key.
+    
+    @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$/}
+    
+    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)
+    
+    
+    respond_to do |format| 
+      format.html # renders timeline.rhtml 
+      format.xml # renders timeline.rxml
+    end                                         
+  end
 end

Added: lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rhtml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rhtml?view=auto&rev=506457
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rhtml (added)
+++ lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rhtml Mon Feb 12 06:20:17 2007
@@ -0,0 +1,46 @@
+<html>
+  <head>
+    ...
+    <script src="http://simile.mit.edu/timeline/api/timeline-api.js" type="text/javascript"></script>
+    <script type="text/javascript">
+    var tl;
+    function onLoad() {
+      var eventSource = new Timeline.DefaultEventSource();
+      var bandInfos = [
+        Timeline.createBandInfo({
+            eventSource:    eventSource,
+            date:           "Jun 28 2006 00:00:00 GMT",
+            width:          "70%", 
+            intervalUnit:   Timeline.DateTime.CENTURY, 
+            intervalPixels: 200
+        }),
+        Timeline.createBandInfo({
+            eventSource:    eventSource,
+            date:           "Jun 28 2006 00:00:00 GMT",
+            width:          "30%", 
+            intervalUnit:   Timeline.DateTime.YEAR, 
+            intervalPixels: 200
+        })
+      ];
+      bandInfos[0].syncWith = 1;
+      bandInfos[0].highlight = true;
+
+      tl = Timeline.create(document.getElementById("my-timeline"), bandInfos);
+      Timeline.loadXML("timeline.xml", function(xml, url) { eventSource.loadXML(xml, url); });
+    }
+    
+    var resizeTimerID = null;
+    function onResize() {
+        if (resizeTimerID == null) {
+            resizeTimerID = window.setTimeout(function() {
+                resizeTimerID = null;
+                tl.layout();
+            }, 500);
+        }
+    }
+    </script>
+  </head>
+  <body onload="onLoad();" onresize="onResize();">
+    <div id="my-timeline" style="height: 300px; border: 1px solid #aaa"></div>
+  </body>
+</html>

Propchange: lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rhtml
------------------------------------------------------------------------------
    svn:executable = *

Added: 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=auto&rev=506457
==============================================================================
--- lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml (added)
+++ lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml Mon Feb 12 06:20:17 2007
@@ -0,0 +1,49 @@
+# 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.
+
+xml.data do 
+  @data.each do |doc| 
+    xml.event(doc['title_text'],
+      :start => doc['published_year_facet'],
+      :end => doc['published_year_facet'],
+      :title => doc['title_text'],
+      :image => "#{doc['asin_text']}")
+  end
+end
+
+# <data>
+#     <event 
+#         start="May 28 2006 09:00:00 GMT"
+#         end="Jun 15 2006 09:00:00 GMT"
+#         isDuration="true"
+#         title="Writing Timeline documentation"
+#         image="http://simile.mit.edu/images/csail-logo.gif"
+#         >
+#         A few days to write some documentation for &lt;a href="http://simile.mit.edu/timeline/"&gt;Timeline&lt;/a&gt;.
+#         </event>
+#         
+#     <event 
+#         start="Jun 16 2006 00:00:00 GMT"
+#         end="Jun 26 2006 00:00:00 GMT"
+#         title="Friend's wedding"
+#         >
+#         I'm not sure precisely when my friend's wedding is.
+#         </event>
+#         
+#     <event 
+#         start="Aug 02 2006 00:00:00 GMT"
+#         title="Trip to Beijing"
+#         link="http://travel.yahoo.com/"
+#         >
+#         Woohoo!
+#         </event>
+# </data>
\ No newline at end of file

Propchange: lucene/solr/trunk/client/ruby/flare/app/views/simile/timeline.rxml
------------------------------------------------------------------------------
    svn:executable = *