Example usage for org.apache.solr.handler.extraction SolrContentHandler SolrContentHandler

List of usage examples for org.apache.solr.handler.extraction SolrContentHandler SolrContentHandler

Introduction

In this page you can find the example usage for org.apache.solr.handler.extraction SolrContentHandler SolrContentHandler.

Prototype

public SolrContentHandler(Metadata metadata, SolrParams params, IndexSchema schema) 

Source Link

Usage

From source file:com.ngdata.hbaseindexer.parse.tika.TikaSolrDocumentExtractor.java

License:Apache License

private SolrInputDocument extractInternal(byte[] input) {
    Metadata metadata = new Metadata();
    metadata.add(LiteralMimeDetector.MIME_TYPE, mimeType);

    Map<String, String> cellParams = (params == null || params.isEmpty()) ? DEFAULT_CELL_PARAMS : params;
    SolrContentHandler handler = new SolrContentHandler(metadata, new MapSolrParams(cellParams), indexSchema);

    try {/*from  w  w w. j  a  va2 s  .c  o m*/
        parser.parse(new ByteArrayInputStream(input), handler, metadata, new ParseContext());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    return handler.newDocument();
}