lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan McKinley (JIRA)" <>
Subject [jira] [Commented] (SOLR-8902) ReturnFields can return fields that were not requested
Date Fri, 25 Mar 2016 15:40:25 GMT


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());

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:

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

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:
>             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:
> adds all the 'fields' to 'okFieldName'
> I think that should be removed

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message