[
https://issues.apache.org/jira/browse/SOLR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13504540#comment-13504540
]
Lukas Graf commented on SOLR-139:
---------------------------------
This feature doesn't work as advertised in Solr 4.0.0 (final).
Since it's not documented, I used the information in these blog posts
([yonik.com|http://yonik.com/solr/atomic-updates/],
[solr.pl|http://solr.pl/en/2012/07/09/solr-4-0-partial-documents-update/]) and
this ticket to try to get it working, and asked in the #solr IRC channel, to no
avail.
Whenever I use the 'set' command in an update message, it mangles the value to
something like {code:xml}<str name="Title">{set=My new title}</str>{code} , and
drops all other fields.
I tried the JSON as well as the XML Syntax for the update message, and I tried
it with both a manually defined '_version_' field and without.
Relevant parts from my schema.xml:
{code:xml}
<schema name="solr-instance" version="1.4">
<fields>
<field name="Creator" type="string" indexed="true" stored="true"
required="false" multiValued="false" />
<!-- ... -->
<field name="Title" type="text" indexed="true" stored="true"
required="false" multiValued="false" />
<field name="UID" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
<field name="_version_" type="long" indexed="true" stored="true"
required="false" multiValued="false" />
</fields>
<!-- ... -->
<uniqueKey>UID</uniqueKey>
</schema>
{code}
I initially created some content like this:
{noformat}
$ curl 'localhost:8983/solr/update?commit=true' -H
'Content-type:application/json' -d '[{"UID":"7cb8a43c","Title":"My original
Title", "Creator": "John Doe"}]'
{noformat}
Which resulted in this document:
{code:xml}
<doc>
<str name="UID">7cb8a43c</str>
<str name="Title">My original Title</str>
<str name="Creator">John Doe</str>
</doc>
{code}
Then I tried to update that document with this statement:
{noformat}
$ curl 'localhost:8983/solr/update?commit=true' -H
'Content-type:application/json' -d '[{"UID":"7cb8a43c","Title":{"set":"My new
title"}}]'
{noformat}
Which resulted in this mangled document:
{code:xml}
<doc>
<str name="UID">7cb8a43c</str>
<str name="Title">{set=My new title}</str>
</doc>
{code}
(I would have expected the document to still have the value 'John Doe' for the
'Creator' field,
and have the value of its 'Title' field update to 'My new title')
I tried using the XML format for the update message as well:
{code:xml}
<add>
<doc>
<field name="id">7cb8a43c</field>
<field name="Title" update="set">My new title</field>
</doc>
</add>
{code}
Same result as above.
> Support updateable/modifiable documents
> ---------------------------------------
>
> Key: SOLR-139
> URL: https://issues.apache.org/jira/browse/SOLR-139
> Project: Solr
> Issue Type: New Feature
> Components: update
> Reporter: Ryan McKinley
> Fix For: 4.0
>
> Attachments: Eriks-ModifiableDocument.patch,
> Eriks-ModifiableDocument.patch, Eriks-ModifiableDocument.patch,
> Eriks-ModifiableDocument.patch, Eriks-ModifiableDocument.patch,
> Eriks-ModifiableDocument.patch, getStoredFields.patch, getStoredFields.patch,
> getStoredFields.patch, getStoredFields.patch, getStoredFields.patch,
> SOLR-139_createIfNotExist.patch, SOLR-139-IndexDocumentCommand.patch,
> SOLR-139-IndexDocumentCommand.patch, SOLR-139-IndexDocumentCommand.patch,
> SOLR-139-IndexDocumentCommand.patch, SOLR-139-IndexDocumentCommand.patch,
> SOLR-139-IndexDocumentCommand.patch, SOLR-139-IndexDocumentCommand.patch,
> SOLR-139-IndexDocumentCommand.patch, SOLR-139-IndexDocumentCommand.patch,
> SOLR-139-IndexDocumentCommand.patch, SOLR-139-IndexDocumentCommand.patch,
> SOLR-139-ModifyInputDocuments.patch, SOLR-139-ModifyInputDocuments.patch,
> SOLR-139-ModifyInputDocuments.patch, SOLR-139-ModifyInputDocuments.patch,
> SOLR-139.patch, SOLR-139.patch, SOLR-139-XmlUpdater.patch,
> SOLR-269+139-ModifiableDocumentUpdateProcessor.patch
>
>
> It would be nice to be able to update some fields on a document without
> having to insert the entire document.
> Given the way lucene is structured, (for now) one can only modify stored
> fields.
> While we are at it, we can support incrementing an existing value - I think
> this only makes sense for numbers.
> for background, see:
> http://www.nabble.com/loading-many-documents-by-ID-tf3145666.html#a8722293
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]