From 32d4ad8b3beb7429d7e5b82e395069831d9660e4 Mon Sep 17 00:00:00 2001 From: Erik Hatcher Date: Sun, 4 Feb 2007 09:39:55 +0000 Subject: [PATCH] Added author and page count to import. Adjusted schema to not stem or remove stop words. git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@503377 13f79535-47bb-0310-9956-ffa450edef68 --- .../solrb/examples/delicious_library/conf/schema.xml | 10 +++++----- .../solrb/examples/delicious_library/dl_importer.rb | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/client/ruby/solrb/examples/delicious_library/conf/schema.xml b/client/ruby/solrb/examples/delicious_library/conf/schema.xml index 0dbdcbbc469..74d39c4dcd6 100755 --- a/client/ruby/solrb/examples/delicious_library/conf/schema.xml +++ b/client/ruby/solrb/examples/delicious_library/conf/schema.xml @@ -146,19 +146,19 @@ - + - + - - + + - + diff --git a/client/ruby/solrb/examples/delicious_library/dl_importer.rb b/client/ruby/solrb/examples/delicious_library/dl_importer.rb index 3f4fb40c47c..1978c480543 100755 --- a/client/ruby/solrb/examples/delicious_library/dl_importer.rb +++ b/client/ruby/solrb/examples/delicious_library/dl_importer.rb @@ -1,3 +1,4 @@ +#!/usr/bin/env ruby # 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 @@ -22,7 +23,7 @@ debug = ARGV[1] == "-debug" solr = Solr::Connection.new(solr_url) lines = IO.readlines(dl_filename) -headers = lines[0].split("\t") +headers = lines[0].split("\t").collect{|h| h.chomp} puts headers.join(','),"-----" if debug # Exported column names @@ -41,11 +42,13 @@ mapping = { :title_text => :title, :notes_text => :notes, :publisher_text => :publisher, - :description_text => :description + :description_text => :description, + :author_text => :author, + :pages_text => :pages } lines[1..-1].each do |line| - data = headers.zip(line.split("\t")) + data = headers.zip(line.split("\t").collect{|s| s.chomp}) def data.method_missing(key) self.assoc(key.to_s)[1] end @@ -60,6 +63,7 @@ lines[1..-1].each do |line| doc[solr_name] = value if value end + puts data.title puts doc.inspect if debug solr.add doc unless debug