Example usage for org.apache.solr.client.solrj SolrClient addBean

List of usage examples for org.apache.solr.client.solrj SolrClient addBean

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj SolrClient addBean.

Prototype

public UpdateResponse addBean(Object obj) throws IOException, SolrServerException 

Source Link

Document

Adds a single bean The bean is converted to a SolrInputDocument by the client's org.apache.solr.client.solrj.beans.DocumentObjectBinder

Usage

From source file:net.yacy.cora.federate.solr.instance.ServerShard.java

License:Open Source License

/**
 * Adds a single bean/*www. ja va2s.co m*/
 * @param obj  the input bean
 * @throws IOException If there is a low-level I/O error.
 */
@Override
public UpdateResponse addBean(Object obj) throws IOException, SolrServerException {
    if (!this.writeEnabled)
        return _dummyOKResponse;
    UpdateResponse ur = null;
    for (SolrClient s : this.shards)
        ur = s.addBean(obj);
    return ur;
}

From source file:org.hadatac.console.models.SecurityRole.java

License:Apache License

public void save() {
    SolrClient solrClient = new HttpSolrClient(
            Play.application().configuration().getString("hadatac.solr.users")
                    + Collections.AUTHENTICATE_ROLES);

    if (this.id_s == null) {
        this.id_s = UUID.randomUUID().toString();
    }//from w  w  w . j  av  a  2s.  c  om

    try {
        solrClient.addBean(this);
        solrClient.commit();
        solrClient.close();
    } catch (Exception e) {
        System.out.println("[ERROR] SecurityRole.save - Exception message: " + e.getMessage());
    }
}