On Thu, Jul 12, 2012 at 3:20 PM, Jonatan Fournier
<jonatan.fourn...@gmail.com> wrote:
> Yonik,
>
> On Thu, Jul 12, 2012 at 12:52 PM, Yonik Seeley
> <yo...@lucidimagination.com> wrote:
>> On Thu, Jul 12, 2012 at 12:38 PM, Jonatan Fournier
>> <jonatan.fourn...@gmail.com> wrote:
>>> On Thu, Jul 12, 2012 at 11:05 AM, Erick Erickson
>>>> The partial documents update that Jonatan references also requires
>>>> that all the fields be stored.
>>>
>>> If my only fields with stored="false" are copyField (e.g. I don't need
>>> their content to rebuild the document), are they gonna be re-copied
>>> with the partial document update?
>>
>> Correct - your setup should be fine.  Only original source fields (non
>> copyField targets) should have stored=true
>
> Another question I had related to partial update...
>
> $ ./post.sh foo.json
> {"responseHeader":{"status":409,"QTime":0},"error":{"msg":"Document
> not found for update.  id=foo","code":409}}
>
> Is there a flag for: if document does not exist, create it for me? The
> thing is that I don't know in advance if the document already exist
> (of course I could query first.. but I have millions of entry to
> process, might exist, might be an update I don't know...)
>
> My naive approach was to have in the same request two documents, one
> with only "set" using the unique ID, and then in the second one all
> the "add" (concerning multivalue field).
>
> So it would do the following:
>
> 1. Document (with id) exist or not don't care, use the following "set"
> command to update/create
> 2. 2nd pass, I know you exist (with above id), please add all those to
> the multivalue fields (none of those fields are in the initial
> updates)
>
> My rationale is that if the document exists, reset some fields, and
> then append the multivalue fields (those multivalue fields express
> historical updates)

Probably silly mistake on my side, but I don't seem to get the
"append/add" JSON syntax right for multiValue fields...

On my document initial creation it works great with

...
"mv_f":"cat1",
"mv_f":"cat2",
...

But later on when I want to "append" cat3 to the field by doing this:

"mv_f":{"add":"cat3"},
...

I end up with something like this in the index:

"mv_f":["{add=cat3}"],

Obviously something is wrong with my syntax ;)

--
jonatan

>
> The reason I created 2 documents is that Solr doesn't seem happy if I
> mix set and add in the same document :)
>
> --
> jonatan
>
>>
>> -Yonik
>> http://lucidimagination.com

Reply via email to