lib/solr_api.rb
# This method creates indexes based on the *actual* TaxonConcept instances passed in as an argument (enumerable).
This method creates indexes based on the *actual* TaxonConcept instances passed in as an argument (enumerable).
This method creates indexes based on the * actual * TaxonConcept instances passed in as an argument ( enumerable ) .
def build_indexes(taxon_concepts = nil)
    taxon_concepts ||= TaxonConcept.all(:include => [ { :taxon_concept_names => :name }, :flattened_ancestors ] )
    data = {}
    taxon_concepts.each do |taxon_concept|
      best_image = taxon_concept.exemplar_or_best_image_from_solr
      data[taxon_concept.id] = {:common_name => taxon_concept.all_common_names,
               :preferred_scientific_name => [taxon_concept.title],
               :scientific_name => taxon_concept.all_scientific_names,
               :ancestor_taxon_concept_id => taxon_concept.flattened_ancestors.
                 map {|a| a.ancestor_id }.sort.uniq,
               :vetted_id => taxon_concept.vetted_id,
               :published => taxon_concept.published,
               :supercedure_id => taxon_concept.supercedure_id,
               :top_image_id => best_image.blank? ? [] : [best_image.id] }
    end
    send_attributes(data)
  end
def build_indexes ( taxon_concepts = nil ) taxon_concepts ||= TaxonConcept . all ( :include => [ { :taxon_concept_names => :name } , :flattened_ancestors ] ) data = { } taxon_concepts . each do | taxon_concept | best_image = taxon_concept . exemplar_or_best_image_from_solr data [ taxon_concept . id ] = { :common_name => taxon_concept . all_common_names , :preferred_scientific_name => [ taxon_concept . title ] , :scientific_name => taxon_concept . all_scientific_names , :ancestor_taxon_concept_id => taxon_concept . flattened_ancestors . map { | a | a . ancestor_id } . sort . uniq , :vetted_id => taxon_concept . vetted_id , :published => taxon_concept . published , :supercedure_id => taxon_concept . supercedure_id , :top_image_id => best_image . blank? ? [ ] : [ best_image . id ] } end send_attributes ( data ) end
This method creates indexes based on the *actual* TaxonConcept instances passed in as an argument (enumerable).
This method creates indexes based on the * actual * TaxonConcept instances passed in as an argument ( enumerable ) .
taxon_concepts
<not_specific>