You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "yuanyun.cn (JIRA)" <ji...@apache.org> on 2015/02/11 04:30:11 UTC
[jira] [Updated] (SOLR-7097) Update other Document in
DocTransformer
[ https://issues.apache.org/jira/browse/SOLR-7097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
yuanyun.cn updated SOLR-7097:
-----------------------------
Summary: Update other Document in DocTransformer (was: Able to update other Document in DocTransformer)
> Update other Document in DocTransformer
> ---------------------------------------
>
> Key: SOLR-7097
> URL: https://issues.apache.org/jira/browse/SOLR-7097
> Project: Solr
> Issue Type: Improvement
> Reporter: yuanyun.cn
> Priority: Minor
> Labels: searcher, transformers
>
> Solr DocTransformer is good, but it only allows us to change current document: add or remove, update fields.
> It would be great if we can update other document(previous especially) .
> User case:
> We can use flat group mode(group.main=true) to put parent and child close to each other(parent first), then we can use DocTransformer to update parent document when access its child document.
> Some thought about Implementation:
> org.apache.solr.response.TextResponseWriter.writeDocuments(String, ResultContext, ReturnFields)
> when cachMode=true, in the for loop, after transform, we can store the solrdoc in a list, write these doc at the end.
> cachMode = req.getParams().getBool("cachMode", false);
> SolrDocument[] cachedDocs = new SolrDocument[sz];
> for (int i = 0; i < sz; i++) {
> SolrDocument sdoc = toSolrDocument(doc);
> if (transformer != null) {
> transformer.transform(sdoc, id);
> }
> if(cachMode)
> {
> cachedDocs[i] = sdoc;
> }
> else{
> writeSolrDocument( null, sdoc, returnFields, i );
> }
>
> }
> if (transformer != null) {
> transformer.setContext(null);
> }
> if(cachMode) {
> for (int i = 0; i < sz; i++) {
> writeSolrDocument(null, cachedDocs[i], returnFields, i);
> }
> }
> writeEndDocumentList();
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org