Return-Path: Delivered-To: apmail-lucene-solr-commits-archive@locus.apache.org Received: (qmail 72396 invoked from network); 2 Feb 2007 04:33:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Feb 2007 04:33:43 -0000 Received: (qmail 3624 invoked by uid 500); 2 Feb 2007 04:33:49 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 3597 invoked by uid 500); 2 Feb 2007 04:33:49 -0000 Mailing-List: contact solr-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-commits@lucene.apache.org Received: (qmail 3588 invoked by uid 99); 2 Feb 2007 04:33:49 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Feb 2007 20:33:49 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Feb 2007 20:33:42 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 52FF81A981A; Thu, 1 Feb 2007 20:33:22 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r502480 - in /lucene/solr/trunk/client/ruby/solrb: lib/solr/field.rb test/unit/field_test.rb Date: Fri, 02 Feb 2007 04:33:22 -0000 To: solr-commits@lucene.apache.org From: ehatcher@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070202043322.52FF81A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ehatcher Date: Thu Feb 1 20:33:21 2007 New Revision: 502480 URL: http://svn.apache.org/viewvc?view=rev&rev=502480 Log: SOLR-134: Handle Time values using UTC + ISO 8691 representation (contributed by Coda Hale) Modified: lucene/solr/trunk/client/ruby/solrb/lib/solr/field.rb lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb Modified: lucene/solr/trunk/client/ruby/solrb/lib/solr/field.rb URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solrb/lib/solr/field.rb?view=diff&rev=502480&r1=502479&r2=502480 ============================================================================== --- lucene/solr/trunk/client/ruby/solrb/lib/solr/field.rb (original) +++ lucene/solr/trunk/client/ruby/solrb/lib/solr/field.rb Thu Feb 1 20:33:21 2007 @@ -11,6 +11,7 @@ # limitations under the License. require 'rexml/document' +require 'time' class Solr::Field attr_accessor :name @@ -19,7 +20,9 @@ def initialize(key_val, opts={}) raise "first argument must be a hash" unless key_val.kind_of? Hash @name = key_val.keys[0].to_s - @value = key_val.values[0].to_s + @value = key_val.values[0] + # Convert any Time values into UTC/XML schema format (which Solr requires). + @value = @value.respond_to?(:utc) ? @value.utc.xmlschema : @value.to_s end def to_xml Modified: lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb?view=diff&rev=502480&r1=502479&r2=502480 ============================================================================== --- lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb (original) +++ lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb Thu Feb 1 20:33:21 2007 @@ -21,6 +21,12 @@ assert_equal "Erik Hatcher", field.to_xml.to_s end + def test_xml_date + field = Solr::Field.new :time => Time.now + assert_kind_of REXML::Element, field.to_xml + assert_match(/[\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}:[\d]{2}:[\d]{2}Z<\/field>/, field.to_xml.to_s) + end + def test_i18n_xml field = Solr::Field.new :i18nstring => 'Äêâîôû Öëäïöü' assert_kind_of REXML::Element, field.to_xml