Skip to content

Apache Lucene open-source search software

Add future example of what a solr-ruby Solr writer type could do with dates

Erik Hatcher88e0370f036a
diff --git a/client/ruby/solr-ruby/lib/solr/response/ruby.rb b/client/ruby/solr-ruby/lib/solr/response/ruby.rb
index 6e8f651748c..05424c13d83 100644
--- a/client/ruby/solr-ruby/lib/solr/response/ruby.rb
+++ b/client/ruby/solr-ruby/lib/solr/response/ruby.rb
@@ -38,5 +38,5 @@ class Solr::Response::Ruby < Solr::Response::Base
def query_time
@header['QTime']
end
-
+
end
diff --git a/client/ruby/solr-ruby/test/conf/schema.xml b/client/ruby/solr-ruby/test/conf/schema.xml
index 9ebe4d3f12f..67c921513e5 100755
--- a/client/ruby/solr-ruby/test/conf/schema.xml
+++ b/client/ruby/solr-ruby/test/conf/schema.xml
@@ -212,6 +212,7 @@
both match, the first appearing in the schema will be used. -->
<dynamicField name="*_facet" type="string" indexed="true" stored="true"/>
<dynamicField name="*_text" type="text" indexed="true" stored="true"/>
+ <dynamicField name="*_date" type="date" indexed="true" stored="true"/>
</fields>
<!-- field to use to determine and enforce document uniqueness. -->
diff --git a/client/ruby/solr-ruby/test/functional/server_test.rb b/client/ruby/solr-ruby/test/functional/server_test.rb
index 5b6e57bbfe5..c94a7dd40f7 100644
--- a/client/ruby/solr-ruby/test/functional/server_test.rb
+++ b/client/ruby/solr-ruby/test/functional/server_test.rb
@@ -35,12 +35,15 @@ class ServerTest < Test::Unit::TestCase
@connection.delete(123456)
# add it
- @connection.add(:id => 123456, :text => 'Borges')
+ @connection.add(:id => 123456, :text => 'Borges') # add :some_date => 'NOW/HOUR' to test richer data type handling
+ # now = DateTime.now
# look for it
response = @connection.query('Borges')
assert_equal 1, response.total_hits
- assert_equal '123456', response.hits[0]['id']
+ hit = response.hits[0]
+ assert_equal '123456', hit['id']
+ # assert_equal now.year, hit['whatever_date'].year
# look for it via dismax
response = @connection.search('Borges')