Example usage for org.apache.solr.common SolrDocument putAll

List of usage examples for org.apache.solr.common SolrDocument putAll

Introduction

In this page you can find the example usage for org.apache.solr.common SolrDocument putAll.

Prototype

@Override
    public void putAll(Map<? extends String, ? extends Object> t) 

Source Link

Usage

From source file:org.eclipse.rdf4j.sail.solr.SolrIndex.java

License:Open Source License

@Override
protected SearchDocument copyDocument(SearchDocument doc) {
    SolrDocument document = ((SolrSearchDocument) doc).getDocument();
    SolrDocument newDocument = new SolrDocument();
    newDocument.putAll(document);
    return new SolrSearchDocument(newDocument);
}

From source file:org.springframework.data.search.solr.SolrIndexEntry.java

License:Apache License

/**
 * Instantiates a new Solr document using the keys and values in a map as
 * the fields for the document.//  ww w . j av  a 2s . co m
 * 
 * @param fields A {@link Map} representing the fields to be added to the
 *            Solr document.
 */
public SolrIndexEntry(final Map<String, Object> fields) {
    final SolrDocument nativeDocument = new SolrDocument();
    nativeDocument.putAll(fields);

    this.solrDocument = nativeDocument;
}

From source file:org.springframework.data.search.solr.SolrTemplate.java

License:Apache License

/**
 * {@inheritDoc}//from www. j a v  a 2s.  co  m
 */
@Override
public String add(final IndexEntry document) {
    String id = addIdToDocumentIfEnabled(document);
    org.apache.solr.common.SolrDocument solrDocument = new org.apache.solr.common.SolrDocument();
    solrDocument.putAll(document);
    try {
        addDocument(solrDocument);
        if (isAutoCommit()) {
            commit();
        }
    } catch (Exception e) {
        throw potentiallyConvertCheckedException(new RuntimeException(e.getCause()));
    }
    return id;
}

From source file:org.springframework.data.search.solr.SolrTemplate.java

License:Apache License

/**
 * {@inheritDoc}//from  www  . ja  v  a 2  s  . c  o m
 */
@Override
public Collection<String> add(final Collection<IndexEntry> documents) {
    org.apache.solr.common.SolrDocument solrDocument;
    List<String> ids = new ArrayList<String>(documents.size());

    for (IndexEntry document : documents) {
        ids.add(addIdToDocumentIfEnabled(document));
        solrDocument = new org.apache.solr.common.SolrDocument();
        solrDocument.putAll(document);
        try {
            addDocument(solrDocument);
        } catch (Exception e) {
            throw potentiallyConvertCheckedException(new RuntimeException(e.getCause()));
        }
    }

    try {
        if (isAutoCommit()) {
            commit();
        }
    } catch (Exception e) {
        throw potentiallyConvertCheckedException(new RuntimeException(e.getCause()));
    }
    return ids;
}