Allow a Hash to be an available mapper parameter, instead of the client having to create a Mapper instance itself

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@532567 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2007-04-26 02:08:11 +00:00
parent 4866d6e22f
commit d1f038a1c8

View File

@ -11,7 +11,8 @@
# limitations under the License.
class Solr::Indexer
def self.index(data_source, mapper, options={})
def self.index(data_source, mapper_or_mapping, options={})
mapper = mapper_or_mapping.is_a?(Hash) ? Solr::Importer::Mapper.new(mapper_or_mapping) : mapper_or_mapping
solr_url = options[:solr_url] || ENV["SOLR_URL"] || "http://localhost:8983/solr"
solr = Solr::Connection.new(solr_url, options) #TODO - these options contain the solr_url and debug keys also, so tidy up what gets passed