You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sami Siren <ss...@gmail.com> on 2012/08/07 10:24:06 UTC

Re: Updating document with the Solr Java API

On Tue, Jul 31, 2012 at 5:16 PM, Jonatan Fournier
<jo...@gmail.com> wrote:
> Hi,
>
> What is the Java syntax to create an update document?

Currently to update a field in a document with solrj you need to do
something like this:

    doc = new SolrInputDocument();
    doc.addField("id", "unique");
    doc.addField("_version_", version); // this is needed only if
optimistic locking is to be used
    HashMap<String, Object> value = new HashMap<String, Object>();
    value.put("set",100);
    doc.addField("price_f", value);

--
 Sami Siren