[ 
https://issues.apache.org/jira/browse/SOLR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12516598
 ] 

Ryan McKinley commented on SOLR-139:
------------------------------------


> 
> So I think that we need a modifyDocument() call on updateHandler, and perhaps 
> a ModifyUpdateCommand to go along with it.
> 
> I'm not sure yet what this means for request processors.  Perhaps another 
> method that handles the reloaded storedFields?
>

Another option might be some sort of transaction or locking model.  Could it 
block other requests while there is an open transaction/lock?

Consider the case where we need the same atomic protection for fields loaded 
from non-stored fields loaded from a SQL database.  In this case, it may be 
nice to have locking/blocking happen at the processor level.

I don't know synchronized well enough to know if this works or is a bad idea, 
but what about something like:

class ModifyExistingDocumentProcessor {
  void processAdd(AddUpdateCommand cmd) {
    String id = cmd.getIndexedId(schema);
    synchronized( updateHandler ) {
       SolrDocument existing = updateHandler.loadStoredFields( id );
       myCustomHelper.loadTagsFromDB( existing );
       cmd.solrDoc = ModifyDocumentUtils.modifyDocument( ... );
       
       // This eventually calls: updateHandler.addDoc(cmd);
       super.processAdd(cmd);
    }
  }
}

This type of approach would need to make sure everyone modifying fields was 
locking on the same updateHandler.

- - - -

I'm not against adding a ModifyUpdateCommand, I just like having the modify 
logic sit outside the UpdateHandler.

> Support updateable/modifiable documents
> ---------------------------------------
>
>                 Key: SOLR-139
>                 URL: https://issues.apache.org/jira/browse/SOLR-139
>             Project: Solr
>          Issue Type: Improvement
>          Components: update
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>         Attachments: getStoredFields.patch, getStoredFields.patch, 
> getStoredFields.patch, getStoredFields.patch, getStoredFields.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-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.
-
You can reply to this email to add a comment to the issue online.

Reply via email to