@Test public void testConfReader() throws Exception { FieldMappingReader fieldMappingReader = new FieldMappingReader(); SolrMappingConfiguration mapping = fieldMappingReader.getConf(this.getClass(). getResourceAsStream("/solrmapping.xml")); assertNotNull(mapping); Map<String, Map<String, String>> featureStructuresMapping = mapping.getFeatureStructuresMapping(); assertNotNull(featureStructuresMapping); assertTrue(featureStructuresMapping.size() > 0); for (String type : featureStructuresMapping.keySet()) { assertTrue(featureStructuresMapping.get(type) != null && featureStructuresMapping.get(type).size() > 0); } assertEquals("language", mapping.getDocumentLanguageMapping()); assertEquals("text", mapping.getDocumentTextMapping()); }
public SolrMappingConfiguration getConf(InputStream input) throws ParserConfigurationException, SAXException, IOException { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); FieldMappingHandler handler = new FieldMappingHandler(); parser.parse(input, handler); Map<String, Map<String, String>> fieldMapping = handler.getFieldMapping(); String documentText = handler.getDocumentText(); String documentLanguage = handler.getDocumentLanguage(); input.close(); return new SolrMappingConfiguration(documentText, documentLanguage, fieldMapping); }
FieldMappingReader { public SolrMappingConfiguration getConf(InputStream input) throws ParserConfigurationException, SAXException, IOException { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); FieldMappingHandler handler = new FieldMappingHandler(); parser.parse(input, handler); Map<String, Map<String, String>> fieldMapping = handler.getFieldMapping(); String documentText = handler.getDocumentText(); String documentLanguage = handler.getDocumentLanguage(); input.close(); return new SolrMappingConfiguration(documentText, documentLanguage, fieldMapping); } }
FieldMappingReader { public SolrMappingConfiguration getConf(InputStream input) throws ParserConfigurationException, SAXException, IOException { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); FieldMappingHandler handler = new FieldMappingHandler(); parser.parse(input, handler); Map<String, Map<String, String>> fieldMapping = handler.getFieldMapping(); String documentText = handler.getDocumentText(); String documentLanguage = handler.getDocumentLanguage(); input.close(); return new SolrMappingConfiguration(documentText, documentLanguage, fieldMapping); }  }
FieldMappingReader { public SolrMappingConfiguration getConf(InputStream input) throws ParserConfigurationException, SAXException, IOException { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); FieldMappingHandler handler = new FieldMappingHandler(); parser.parse(input, handler); Map<String, Map<String, String>> fieldMapping = handler.getFieldMapping(); String documentText = handler.getDocumentText(); String documentLanguage = handler.getDocumentLanguage(); input.close(); return new SolrMappingConfiguration(documentText, documentLanguage, fieldMapping); }  SolrMappingConfiguration getConf(InputStream input); }
FieldMappingReader { public SolrMappingConfiguration getConf(InputStream input) throws ParserConfigurationException, SAXException, IOException { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); FieldMappingHandler handler = new FieldMappingHandler(); parser.parse(input, handler); Map<String, Map<String, String>> fieldMapping = handler.getFieldMapping(); String documentText = handler.getDocumentText(); String documentLanguage = handler.getDocumentLanguage(); input.close(); return new SolrMappingConfiguration(documentText, documentLanguage, fieldMapping); }  SolrMappingConfiguration getConf(InputStream input);  }