[ 
https://issues.apache.org/jira/browse/SOLR-446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557887#action_12557887
 ] 

Ryan McKinley commented on SOLR-446:
------------------------------------

good catch Hoss!

Looking at it again, the 'score' bit is weird too -- you would get duplicate 
'score' fields if you chained this (i think)
{code:java}
    if (includeScore) {
      writeVal("score", doc.getFirstValue("score"));
    }
{code}

perhaps it should be:
{code:java}
Index: src/java/org/apache/solr/request/XMLWriter.java
===================================================================
--- src/java/org/apache/solr/request/XMLWriter.java     (revision 610424)
+++ src/java/org/apache/solr/request/XMLWriter.java     (working copy)
@@ -342,11 +342,14 @@
     startTag("doc", name, false);
     incLevel();

-    if (includeScore) {
-      writeVal("score", doc.getFirstValue("score"));
+    if (includeScore && returnFields != null ) {
+      returnFields.add( "score" );
     }

     for (String fname : doc.getFieldNames()) {
+      if (returnFields!=null && !returnFields.contains(fname)) {
+        continue;
+      }
       Object val = doc.getFieldValue(fname);

       if (val instanceof Collection) {
{code}

> TextResponseWriter should be able to work with SolrDocument and 
> SolrDocumentList
> --------------------------------------------------------------------------------
>
>                 Key: SOLR-446
>                 URL: https://issues.apache.org/jira/browse/SOLR-446
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>             Fix For: 1.3
>
>         Attachments: SOLR-446-WriteSolrDocument.patch
>
>
> ResponseWriters should be able to write SolrDocuments the same way they write 
> Documents.  This will be useful for SOLR-303 or other RequestHandlres that 
> modify a SolrDocument and return the result.

-- 
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