Class: Geoloader::Loaders::ShapefileSolr

Inherits:
Loader
  • Object
show all
Defined in:
lib/geoloader/loaders/shapefile_solr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Loader

load_or_enqueue, perform

Constructor Details

#initialize(*args) ⇒ ShapefileSolr

Configure the shapefile, connect to Solr.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/geoloader/loaders/shapefile_solr.rb', line 14

def initialize(*args)

  super

  # Create and configure the asset.
  @shapefile = Geoloader::Assets::Asset.new(@file_path, @workspace, @desc_path)
  @shapefile.extend(Geoloader::Assets::Shapefile)
  @shapefile.extend(Geoloader::Assets::Solr)

  # Connect to Solr.
  @solr = Geoloader::Services::Solr.new

end

Instance Attribute Details

#shapefileObject (readonly)

Returns the value of attribute shapefile.



7
8
9
# File 'lib/geoloader/loaders/shapefile_solr.rb', line 7

def shapefile
  @shapefile
end

#solrObject (readonly)

Returns the value of attribute solr.



7
8
9
# File 'lib/geoloader/loaders/shapefile_solr.rb', line 7

def solr
  @solr
end

Instance Method Details

#loadObject

Push a Shapefile to Solr.



31
32
33
34
35
# File 'lib/geoloader/loaders/shapefile_solr.rb', line 31

def load
  @shapefile.stage do
    @solr.create_document(@shapefile)
  end
end