Changeset 6386


Ignore:
Timestamp:
07/14/15 09:42:13 (9 years ago)
Author:
davor.ostojic@oeaw.ac.at
Message:

NULL values in VLO's facet values
ProfileID & ProfileName? facets

Location:
vlo/branches/vlo-3.3-oeaw/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-3.3-oeaw/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIData.java

    r2828 r6386  
    22
    33import eu.clarin.cmdi.vlo.FacetConstants;
     4
    45import java.util.ArrayList;
    56import java.util.Collection;
    67import java.util.List;
     8
    79import org.apache.solr.common.SolrInputDocument;
    810import org.slf4j.Logger;
     
    3840    private final List<Resource> landingPageResources = new ArrayList<Resource>();
    3941    private final List<Resource> searchPageResources = new ArrayList<Resource>();
     42   
     43    private String profileId;
     44    private String profileName;
    4045
    4146    public SolrInputDocument getSolrDocument() {
     
    147152        return id;
    148153    }
     154
     155        public void setProfileId(String profileId) {
     156                this.profileId = profileId;
     157               
     158        }
     159       
     160        public String getProfileId() {
     161                return profileId;               
     162        }
     163
     164        public String getProfileName() {
     165                return profileName;
     166        }
     167
     168        public void setProfileName(String profileName) {
     169                this.profileName = profileName;
     170        }
     171       
     172       
    149173}
  • vlo/branches/vlo-3.3-oeaw/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXML.java

    r6311 r6386  
    4646
    4747        VTDNav nav = vg.getNav();
    48         FacetMapping facetMapping = getFacetMapping(nav.cloneNav());
     48        String profileId = extractXsd(nav.cloneNav());
     49        cmdiData.setProfileId(profileId);
     50        FacetMapping facetMapping = getFacetMapping(profileId);
    4951
    5052        if (facetMapping.getFacets().isEmpty()) {
     
    5254        }
    5355
     56        List<String> profileName = (postProcessors.get(FacetConstants.FIELD_CLARIN_PROFILE)).process(profileId);
     57        cmdiData.setProfileName(profileName.get(0));
    5458        nav.toElement(VTDNav.ROOT);
    5559        processResources(cmdiData, nav);
     
    7478     * @throws VTDException
    7579     */
    76     private FacetMapping getFacetMapping(VTDNav nav) throws VTDException {
    77         String profileId = extractXsd(nav);
     80    private FacetMapping getFacetMapping(String profileId) throws VTDException {
    7881        if (profileId == null) {
    7982            throw new RuntimeException("Cannot get xsd schema so cannot get a proper mapping. Parse failed!");
  • vlo/branches/vlo-3.3-oeaw/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r6354 r6386  
    433433        addResourceData(solrDocument, cmdiData);
    434434       
     435       
     436        //Add profileId & profileName
     437        solrDocument.addField("profileName", cmdiData.getProfileName());
     438        solrDocument.addField("profileId", cmdiData.getProfileId());
     439       
     440       
     441        //Add missing facets with "null" val
     442        for(String facet: config.getFacetFields()){
     443                if(!solrDocument.getFieldNames().contains(facet))
     444                        solrDocument.addField(facet, "null");
     445        }
     446       
     447       
    435448        LOG.debug("Adding document for submission to SOLR: {}", file);
    436449        docs.add(solrDocument);
Note: See TracChangeset for help on using the changeset viewer.