@Test public void testMapOnHtml() throws Exception { String text = "<br/><b>sample text</b><br/>"; DocumentText key = DocumentText.newBuilder().setId(id).setText(text).build(); ingester.map(new AvroKey<DocumentText>(key), null, context); verify(context, times(1)).write(resultCaptor.capture(), any()); DocumentText value = resultCaptor.getValue().datum(); assertNotNull(value); assertEquals(id, value.getId()); assertEquals("sample text", value.getText()); }
@Override protected void map(AvroKey<DocumentText> key, NullWritable value, Context context) throws IOException, InterruptedException { DocumentText htmlText = key.datum(); final DocumentText.Builder output = DocumentText.newBuilder(); output.setId(htmlText.getId()); try { output.setText(cleanNoMarkup(htmlText.getText().toString())); context.write(new AvroKey<DocumentText>(output.build()), NullWritable.get()); } catch (Exception e) { log.error("exception thrown when trying to extract text representation " + "from html document identified with: " + htmlText.getId(), e); } }
HtmlToPlaintextIngester extends Mapper<AvroKey<DocumentText>, NullWritable, AvroKey<DocumentText>, NullWritable> { @Override protected void map(AvroKey<DocumentText> key, NullWritable value, Context context) throws IOException, InterruptedException { DocumentText htmlText = key.datum(); final DocumentText.Builder output = DocumentText.newBuilder(); output.setId(htmlText.getId()); try { output.setText(cleanNoMarkup(htmlText.getText().toString())); context.write(new AvroKey<DocumentText>(output.build()), NullWritable.get()); } catch (Exception e) { log.error("exception thrown when trying to extract text representation " + "from html document identified with: " + htmlText.getId(), e); } } }
HtmlToPlaintextIngester extends Mapper<AvroKey<DocumentText>, NullWritable, AvroKey<DocumentText>, NullWritable> { @Override protected void map(AvroKey<DocumentText> key, NullWritable value, Context context) throws IOException, InterruptedException { DocumentText htmlText = key.datum(); final DocumentText.Builder output = DocumentText.newBuilder(); output.setId(htmlText.getId()); try { output.setText(cleanNoMarkup(htmlText.getText().toString())); context.write(new AvroKey<DocumentText>(output.build()), NullWritable.get()); } catch (Exception e) { log.error("exception thrown when trying to extract text representation " + "from html document identified with: " + htmlText.getId(), e); } }  }
HtmlToPlaintextIngester extends Mapper<AvroKey<DocumentText>, NullWritable, AvroKey<DocumentText>, NullWritable> { @Override protected void map(AvroKey<DocumentText> key, NullWritable value, Context context) throws IOException, InterruptedException { DocumentText htmlText = key.datum(); final DocumentText.Builder output = DocumentText.newBuilder(); output.setId(htmlText.getId()); try { output.setText(cleanNoMarkup(htmlText.getText().toString())); context.write(new AvroKey<DocumentText>(output.build()), NullWritable.get()); } catch (Exception e) { log.error("exception thrown when trying to extract text representation " + "from html document identified with: " + htmlText.getId(), e); } }   }
HtmlToPlaintextIngester extends Mapper<AvroKey<DocumentText>, NullWritable, AvroKey<DocumentText>, NullWritable> { @Override protected void map(AvroKey<DocumentText> key, NullWritable value, Context context) throws IOException, InterruptedException { DocumentText htmlText = key.datum(); final DocumentText.Builder output = DocumentText.newBuilder(); output.setId(htmlText.getId()); try { output.setText(cleanNoMarkup(htmlText.getText().toString())); context.write(new AvroKey<DocumentText>(output.build()), NullWritable.get()); } catch (Exception e) { log.error("exception thrown when trying to extract text representation " + "from html document identified with: " + htmlText.getId(), e); } }    }