Example usage for org.apache.solr.common.util ContentStreamBase.FileStream ContentStreamBase.FileStream

List of usage examples for org.apache.solr.common.util ContentStreamBase.FileStream ContentStreamBase.FileStream

Introduction

In this page you can find the example usage for org.apache.solr.common.util ContentStreamBase.FileStream ContentStreamBase.FileStream.

Prototype

public FileStream(File f) 

Source Link

Usage

From source file:at.kc.tugraz.ss.service.solr.impl.SSSolrImpl.java

License:Apache License

@Override
public void solrAddDoc(final SSServPar parA) throws Exception {

    //    according to Solr specification by adding a document with an ID already
    //     existing in the index will replace the document (eg. refer to 
    //     http://stackoverflow.com/questions/8494923/solr-block-updating-of-existing-document or
    //     http://lucene.apache.org/solr/api-4_0_0-ALPHA/doc-files/tutorial.html ) 

    try {//from   w  w w  . j a v  a 2  s .  c  o  m
        final SSSolrAddDocPar par = new SSSolrAddDocPar(parA);
        final ContentStreamUpdateRequest csur = new ContentStreamUpdateRequest("/update/extract");
        final NamedList<Object> response;

        csur.addContentStream(new ContentStreamBase.FileStream(new File(localWorkPath + par.id)));

        csur.setParam("literal.id", par.id);
        csur.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);

        response = solrUpdater.request(csur);

        SSLogU.info("document w/ id " + par.id + " added successfully. ");
    } catch (Exception error) {
        SSServErrReg.regErrThrow(error);
    }
}