lib/supernova/solr_indexer.rb in supernova-0.6.7 vs lib/supernova/solr_indexer.rb in supernova-0.6.8

- old
+ new

@@ -230,10 +230,11 @@ end end end def index_with_json(rows) + return false if rows.empty? options && options[:use_json_file] ? index_with_json_file(rows) : index_with_json_string(rows) end def solr_rows_to_index_for_query(query) query_db(query).map do |row| @@ -244,14 +245,16 @@ def index_query(query) debug "getting rows for #{query[0,100]}" index_rows(query_db(query)) end + # just to be backwards compatible def index_directly(rows) - rows.each do |row| - row = Supernova::Solr.connection.add(row) - end - Supernova::Solr.connection.commit if rows.any? + index_with_json(rows) + # rows.each do |row| + # row = Supernova::Solr.connection.add(row) + # end + # Supernova::Solr.connection.commit if rows.any? end def index_with_json_file(rows) debug "wrote #{rows.count} rows to the json file in %TIME%" do rows.each do |row| \ No newline at end of file