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

Ryan McKinley commented on SOLR-8902:
-------------------------------------

You can get more fields then you request if a DocumentTransformer uses 
`getExtraRequestFields()` SOLR-7622 -- this should tell Lucene to fetch the 
field, but should not affect the fields returned in the final SolrDocument.  An 
'off-the-shelf' example is with the new 'geo' transformer:

{code:title=from the attached patch}
+    // Don't return 'store_rpt' just because it is required by the transformer
+    rf = new SolrReturnFields( req("fl", "[geo f=store_rpt]") );
+    assertFalse( rf.wantsScore() );
+    assertTrue(rf.wantsField("[geo]"));
+    assertFalse( rf.wantsField( "store_rpt" ) );
+    assertFalse(rf.wantsAllFields());
+    assertNotNull(rf.getTransformer());
{code}

I think there are other possible cases, but most of the time, when a 
transformer renames the field, it removes the SolrDocument so the fact that 
ReturnFields allows the original name does not matter.  For example:
{code}
 fl=aaa:bbb
{code}

Without this patch,
{code}
 returnFields.wantsField( 'bbb' ) == true
{code}


bq. Sadly, I don't fully understand what's about and what all this wantsFoo, 
okFoo means

The distinction is between what fields are requested from Lucene and put on the 
SolrDocument passed to the DocumentTransformers vs what fields the end user 
wants to see in the results.  





> ReturnFields can return fields that were not requested
> ------------------------------------------------------
>
>                 Key: SOLR-8902
>                 URL: https://issues.apache.org/jira/browse/SOLR-8902
>             Project: Solr
>          Issue Type: Bug
>          Components: Response Writers
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>            Priority: Minor
>             Fix For: 6.1, trunk
>
>         Attachments: SOLR-8902.diff
>
>
> It looks like something changed that now returns all fields requested from 
> lucene, not just the ones request from solr.
> This is the difference between 'fields' and 'okFieldNames' in 
> SolrReturnFields.
> The logic here:
> https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/search/SolrReturnFields.java#L141
> adds all the 'fields' to 'okFieldName'
> I think that should be removed



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to