@Test public void testGenusSortable() { Taxon taxon = new Taxon(); taxon.setTaxonRank(Rank.GENUS); taxon.setFamily("Asteraceae"); taxon.setScientificName("Echinacea"); SolrInputDocument doc = new TaxonSolrInputDocument(taxon).build(); assertEquals("425AsteraceaeEchinacea", doc.getFieldValue("sortable")); }
public SolrInputDocument build() { indexRank(Rank.FAMILY, "family"); indexRank(Rank.Subfamily, "subfamily"); indexRank(Rank.GENUS, "genus"); indexRank(Rank.Tribe, "tribe"); indexRank(Rank.Subtribe, "subtribe"); addField(sid, "taxon.identifier_s", taxon.getIdentifier()); addField(sid, "taxon.infraspecific_epithet_s_lower", taxon.getInfraspecificEpithet()); addField(sid, "taxon.kingdom_s_lower", taxon.getKingdom()); addField(sid, "taxon.order_s_lower", taxon.getOrder()); addField(sid, "taxon.name_published_in_year_i", taxon.getNamePublishedInYear()); addField(sid, "taxon.name_published_in_s_lower", taxon.getNamePublishedInString()); addField(sid, "taxon.scientific_name_authorship_t", taxon.getScientificNameAuthorship()); addField(sid, "taxon.scientific_name_s_lower", taxon.getScientificName()); addField(sid, "taxon.specific_epithet_s_lower", taxon.getSpecificEpithet()); addField(sid, "taxon.rank_s_lower", Objects.toString(taxon.getTaxonRank(), null)); addField(sid, "taxon.taxonomic_status_s_lower", Objects.toString(taxon.getTaxonomicStatus(), null)); addField(sid, "taxon.is_accepted_b", taxon.isAccepted()); addField(sid, "taxon.looks_accepted_b", taxon.looksAccepted()); addField(sid, "taxon.is_unplaced_b", taxon.getTaxonomicStatus() == null); if(taxon.getTaxonRank() == Rank.SPECIES){ addField(sid, "taxon.species_s_lower", taxon.getScientificName()); } if(taxon.getSynonymNameUsages() != null && !taxon.getSynonymNameUsages().isEmpty()) { Set<Taxon> synonymList = taxon.getSynonymNameUsages(); for(Taxon synonym : synonymList){ addField(sid, "taxon.synonyms_ss_lower", synonym.getScientificName()); } } if(taxon.getAcceptedNameUsage() != null) { addField(sid, "taxon.accepted.identifier_s", taxon.getAcceptedNameUsage().getIdentifier()); addField(sid, "taxon.accepted.scientific_name_s_lower", taxon.getAcceptedNameUsage().getScientificName()); addField(sid, "taxon.accepted.scientific_name_authorship_t", taxon.getAcceptedNameUsage().getScientificNameAuthorship()); addField(sid, "taxon.accepted.kingdom_s", taxon.getAcceptedNameUsage().getKingdom()); } indexDescriptions(); indexDistributions(); indexVernacularNames(); indexMeasurementOrFacts(); indexImages(); addSuggestionWeight(); for(Reference r : taxon.getReferences()) { addSource(r); } for(String source : sources) { sid.addField("searchable.sources_ss", source); sid.addField("searchable.context_ss", normalized(source)); } buildSortField(); return sid; }
TaxonSolrInputDocument extends BaseSolrInputDocument { public SolrInputDocument build() { indexRank(Rank.FAMILY, "family"); indexRank(Rank.Subfamily, "subfamily"); indexRank(Rank.GENUS, "genus"); indexRank(Rank.Tribe, "tribe"); indexRank(Rank.Subtribe, "subtribe"); addField(sid, "taxon.identifier_s", taxon.getIdentifier()); addField(sid, "taxon.infraspecific_epithet_s_lower", taxon.getInfraspecificEpithet()); addField(sid, "taxon.kingdom_s_lower", taxon.getKingdom()); addField(sid, "taxon.order_s_lower", taxon.getOrder()); addField(sid, "taxon.name_published_in_year_i", taxon.getNamePublishedInYear()); addField(sid, "taxon.name_published_in_s_lower", taxon.getNamePublishedInString()); addField(sid, "taxon.scientific_name_authorship_t", taxon.getScientificNameAuthorship()); addField(sid, "taxon.scientific_name_s_lower", taxon.getScientificName()); addField(sid, "taxon.specific_epithet_s_lower", taxon.getSpecificEpithet()); addField(sid, "taxon.rank_s_lower", Objects.toString(taxon.getTaxonRank(), null)); addField(sid, "taxon.taxonomic_status_s_lower", Objects.toString(taxon.getTaxonomicStatus(), null)); addField(sid, "taxon.is_accepted_b", taxon.isAccepted()); addField(sid, "taxon.looks_accepted_b", taxon.looksAccepted()); addField(sid, "taxon.is_unplaced_b", taxon.getTaxonomicStatus() == null); if(taxon.getTaxonRank() == Rank.SPECIES){ addField(sid, "taxon.species_s_lower", taxon.getScientificName()); } if(taxon.getSynonymNameUsages() != null && !taxon.getSynonymNameUsages().isEmpty()) { Set<Taxon> synonymList = taxon.getSynonymNameUsages(); for(Taxon synonym : synonymList){ addField(sid, "taxon.synonyms_ss_lower", synonym.getScientificName()); } } if(taxon.getAcceptedNameUsage() != null) { addField(sid, "taxon.accepted.identifier_s", taxon.getAcceptedNameUsage().getIdentifier()); addField(sid, "taxon.accepted.scientific_name_s_lower", taxon.getAcceptedNameUsage().getScientificName()); addField(sid, "taxon.accepted.scientific_name_authorship_t", taxon.getAcceptedNameUsage().getScientificNameAuthorship()); addField(sid, "taxon.accepted.kingdom_s", taxon.getAcceptedNameUsage().getKingdom()); } indexDescriptions(); indexDistributions(); indexVernacularNames(); indexMeasurementOrFacts(); indexImages(); addSuggestionWeight(); for(Reference r : taxon.getReferences()) { addSource(r); } for(String source : sources) { sid.addField("searchable.sources_ss", source); sid.addField("searchable.context_ss", normalized(source)); } buildSortField(); return sid; } }
TaxonSolrInputDocument extends BaseSolrInputDocument { public SolrInputDocument build() { indexRank(Rank.FAMILY, "family"); indexRank(Rank.Subfamily, "subfamily"); indexRank(Rank.GENUS, "genus"); indexRank(Rank.Tribe, "tribe"); indexRank(Rank.Subtribe, "subtribe"); addField(sid, "taxon.identifier_s", taxon.getIdentifier()); addField(sid, "taxon.infraspecific_epithet_s_lower", taxon.getInfraspecificEpithet()); addField(sid, "taxon.kingdom_s_lower", taxon.getKingdom()); addField(sid, "taxon.order_s_lower", taxon.getOrder()); addField(sid, "taxon.name_published_in_year_i", taxon.getNamePublishedInYear()); addField(sid, "taxon.name_published_in_s_lower", taxon.getNamePublishedInString()); addField(sid, "taxon.scientific_name_authorship_t", taxon.getScientificNameAuthorship()); addField(sid, "taxon.scientific_name_s_lower", taxon.getScientificName()); addField(sid, "taxon.specific_epithet_s_lower", taxon.getSpecificEpithet()); addField(sid, "taxon.rank_s_lower", Objects.toString(taxon.getTaxonRank(), null)); addField(sid, "taxon.taxonomic_status_s_lower", Objects.toString(taxon.getTaxonomicStatus(), null)); addField(sid, "taxon.is_accepted_b", taxon.isAccepted()); addField(sid, "taxon.looks_accepted_b", taxon.looksAccepted()); addField(sid, "taxon.is_unplaced_b", taxon.getTaxonomicStatus() == null); if(taxon.getTaxonRank() == Rank.SPECIES){ addField(sid, "taxon.species_s_lower", taxon.getScientificName()); } if(taxon.getSynonymNameUsages() != null && !taxon.getSynonymNameUsages().isEmpty()) { Set<Taxon> synonymList = taxon.getSynonymNameUsages(); for(Taxon synonym : synonymList){ addField(sid, "taxon.synonyms_ss_lower", synonym.getScientificName()); } } if(taxon.getAcceptedNameUsage() != null) { addField(sid, "taxon.accepted.identifier_s", taxon.getAcceptedNameUsage().getIdentifier()); addField(sid, "taxon.accepted.scientific_name_s_lower", taxon.getAcceptedNameUsage().getScientificName()); addField(sid, "taxon.accepted.scientific_name_authorship_t", taxon.getAcceptedNameUsage().getScientificNameAuthorship()); addField(sid, "taxon.accepted.kingdom_s", taxon.getAcceptedNameUsage().getKingdom()); } indexDescriptions(); indexDistributions(); indexVernacularNames(); indexMeasurementOrFacts(); indexImages(); addSuggestionWeight(); for(Reference r : taxon.getReferences()) { addSource(r); } for(String source : sources) { sid.addField("searchable.sources_ss", source); sid.addField("searchable.context_ss", normalized(source)); } buildSortField(); return sid; } TaxonSolrInputDocument(Taxon taxon);  TaxonSolrInputDocument(Taxon taxon, ApplicationContext ctx); }
TaxonSolrInputDocument extends BaseSolrInputDocument { public SolrInputDocument build() { indexRank(Rank.FAMILY, "family"); indexRank(Rank.Subfamily, "subfamily"); indexRank(Rank.GENUS, "genus"); indexRank(Rank.Tribe, "tribe"); indexRank(Rank.Subtribe, "subtribe"); addField(sid, "taxon.identifier_s", taxon.getIdentifier()); addField(sid, "taxon.infraspecific_epithet_s_lower", taxon.getInfraspecificEpithet()); addField(sid, "taxon.kingdom_s_lower", taxon.getKingdom()); addField(sid, "taxon.order_s_lower", taxon.getOrder()); addField(sid, "taxon.name_published_in_year_i", taxon.getNamePublishedInYear()); addField(sid, "taxon.name_published_in_s_lower", taxon.getNamePublishedInString()); addField(sid, "taxon.scientific_name_authorship_t", taxon.getScientificNameAuthorship()); addField(sid, "taxon.scientific_name_s_lower", taxon.getScientificName()); addField(sid, "taxon.specific_epithet_s_lower", taxon.getSpecificEpithet()); addField(sid, "taxon.rank_s_lower", Objects.toString(taxon.getTaxonRank(), null)); addField(sid, "taxon.taxonomic_status_s_lower", Objects.toString(taxon.getTaxonomicStatus(), null)); addField(sid, "taxon.is_accepted_b", taxon.isAccepted()); addField(sid, "taxon.looks_accepted_b", taxon.looksAccepted()); addField(sid, "taxon.is_unplaced_b", taxon.getTaxonomicStatus() == null); if(taxon.getTaxonRank() == Rank.SPECIES){ addField(sid, "taxon.species_s_lower", taxon.getScientificName()); } if(taxon.getSynonymNameUsages() != null && !taxon.getSynonymNameUsages().isEmpty()) { Set<Taxon> synonymList = taxon.getSynonymNameUsages(); for(Taxon synonym : synonymList){ addField(sid, "taxon.synonyms_ss_lower", synonym.getScientificName()); } } if(taxon.getAcceptedNameUsage() != null) { addField(sid, "taxon.accepted.identifier_s", taxon.getAcceptedNameUsage().getIdentifier()); addField(sid, "taxon.accepted.scientific_name_s_lower", taxon.getAcceptedNameUsage().getScientificName()); addField(sid, "taxon.accepted.scientific_name_authorship_t", taxon.getAcceptedNameUsage().getScientificNameAuthorship()); addField(sid, "taxon.accepted.kingdom_s", taxon.getAcceptedNameUsage().getKingdom()); } indexDescriptions(); indexDistributions(); indexVernacularNames(); indexMeasurementOrFacts(); indexImages(); addSuggestionWeight(); for(Reference r : taxon.getReferences()) { addSource(r); } for(String source : sources) { sid.addField("searchable.sources_ss", source); sid.addField("searchable.context_ss", normalized(source)); } buildSortField(); return sid; } TaxonSolrInputDocument(Taxon taxon);  TaxonSolrInputDocument(Taxon taxon, ApplicationContext ctx); static String propertyToSolrField(String propertyName, String type); static String solrFieldToProperty(String field); SolrInputDocument build(); }
TaxonSolrInputDocument extends BaseSolrInputDocument { public SolrInputDocument build() { indexRank(Rank.FAMILY, "family"); indexRank(Rank.Subfamily, "subfamily"); indexRank(Rank.GENUS, "genus"); indexRank(Rank.Tribe, "tribe"); indexRank(Rank.Subtribe, "subtribe"); addField(sid, "taxon.identifier_s", taxon.getIdentifier()); addField(sid, "taxon.infraspecific_epithet_s_lower", taxon.getInfraspecificEpithet()); addField(sid, "taxon.kingdom_s_lower", taxon.getKingdom()); addField(sid, "taxon.order_s_lower", taxon.getOrder()); addField(sid, "taxon.name_published_in_year_i", taxon.getNamePublishedInYear()); addField(sid, "taxon.name_published_in_s_lower", taxon.getNamePublishedInString()); addField(sid, "taxon.scientific_name_authorship_t", taxon.getScientificNameAuthorship()); addField(sid, "taxon.scientific_name_s_lower", taxon.getScientificName()); addField(sid, "taxon.specific_epithet_s_lower", taxon.getSpecificEpithet()); addField(sid, "taxon.rank_s_lower", Objects.toString(taxon.getTaxonRank(), null)); addField(sid, "taxon.taxonomic_status_s_lower", Objects.toString(taxon.getTaxonomicStatus(), null)); addField(sid, "taxon.is_accepted_b", taxon.isAccepted()); addField(sid, "taxon.looks_accepted_b", taxon.looksAccepted()); addField(sid, "taxon.is_unplaced_b", taxon.getTaxonomicStatus() == null); if(taxon.getTaxonRank() == Rank.SPECIES){ addField(sid, "taxon.species_s_lower", taxon.getScientificName()); } if(taxon.getSynonymNameUsages() != null && !taxon.getSynonymNameUsages().isEmpty()) { Set<Taxon> synonymList = taxon.getSynonymNameUsages(); for(Taxon synonym : synonymList){ addField(sid, "taxon.synonyms_ss_lower", synonym.getScientificName()); } } if(taxon.getAcceptedNameUsage() != null) { addField(sid, "taxon.accepted.identifier_s", taxon.getAcceptedNameUsage().getIdentifier()); addField(sid, "taxon.accepted.scientific_name_s_lower", taxon.getAcceptedNameUsage().getScientificName()); addField(sid, "taxon.accepted.scientific_name_authorship_t", taxon.getAcceptedNameUsage().getScientificNameAuthorship()); addField(sid, "taxon.accepted.kingdom_s", taxon.getAcceptedNameUsage().getKingdom()); } indexDescriptions(); indexDistributions(); indexVernacularNames(); indexMeasurementOrFacts(); indexImages(); addSuggestionWeight(); for(Reference r : taxon.getReferences()) { addSource(r); } for(String source : sources) { sid.addField("searchable.sources_ss", source); sid.addField("searchable.context_ss", normalized(source)); } buildSortField(); return sid; } TaxonSolrInputDocument(Taxon taxon);  TaxonSolrInputDocument(Taxon taxon, ApplicationContext ctx); static String propertyToSolrField(String propertyName, String type); static String solrFieldToProperty(String field); SolrInputDocument build();  }