[
https://issues.apache.org/jira/browse/SOLR-16287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17566246#comment-17566246
]
Dan Rosher commented on SOLR-16287:
-----------------------------------
When used with the update stream, yes it can atomically update a document. This
is because a tuple as a value is mapped to {*}Map{*}, which is then treated as
an atomic update.
{code:java}
//solr/core/src/java/org/apache/solr/update/processor/AtomicUpdateDocumentMerger.java
private static boolean isAtomicUpdate(SolrInputDocument sdoc) {
for (SolrInputField sif : sdoc.values()) {
Object val = sif.getValue();
if (val instanceof Map && !(val instanceof SolrDocumentBase)) {
return true;
}
} return false;
}
{code}
A simple example of how to do this:
{code:java}
update(articles,
map(
tuple(id=2639901,cand_id=2),
"cand_id=add-distinct"
)
) {code}
Although you might typically fetch information from other sources for updates.
> MapStream - remap tuple value(s)
> ---------------------------------
>
> Key: SOLR-16287
> URL: https://issues.apache.org/jira/browse/SOLR-16287
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Components: streaming expressions
> Affects Versions: 9.0
> Reporter: Dan Rosher
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Remap from (k,v) => k -> newKey -> value
> e.g. with
> map(<stream>,"cand_id=add-distinct") , convert stream tuples from
> From
> {code:java}
> {"cand_id":5718,id:123,v_i:345}{code}
> To
> {code:java}
> {
> id:123,
> v_i:345,
> "cand_id": {
> "add-distinct": 5718
> }, {code}
> Useful for update stream for atomic updates.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]