You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Demian Katz (JIRA)" <ji...@apache.org> on 2015/11/10 19:27:11 UTC

[jira] [Comment Edited] (SOLR-3191) field exclusion from fl

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

Demian Katz edited comment on SOLR-3191 at 11/10/15 6:26 PM:
-------------------------------------------------------------

I just took a look at test coverage for this patch, and it appears that there are a couple of areas where more tests are needed:

1.) I'm not sure what public static String getFieldName(QueryParsing.StrParser sp) is for, but it's not covered at all.

2.) None of the logic related to collectingLiteral seems to be getting tested. I tried adjusting the test class to include a field list containing a function and a literal:

{noformat}
  @Test
  public void testFunctionAndLiteralInFieldList() {
	ReturnFields rf = new SolrReturnFields(req("fl", "ordOfId:{!func}ord(id),literal:1234"));
	assertTrue(rf.wantsField("ordOfId"));
	assertTrue(rf.wantsField("literal"));
	assertFalse(rf.wantsField("xxx"));
	assertFalse(rf.wantsAllFields());
  }
{noformat}

Unfortunately, while this test passes, it does not appear to affect the coverage as I had expected.

3.) For a little low-hanging-fruit coverage improvement, I added this to testFunkyFieldNames, since the method was not covered at all:

{noformat}
assertEquals("[#foo_s, id]", rf.getRequestedFieldNames().toString());
{noformat}

I'm not sure if that's actually valuable.

Apologies if any of these comments seem ill-informed; this is my first foray into the Solr code. However, we'd really like to see this patch committed to master, and I'm told that good patch test coverage helps things move along, so I thought I'd take a stab at it. I hope this is of some use! Please let me know if I can be of further assistance.


was (Author: demiankatz):
I just took a look at test coverage for this patch, and it appears that there are a couple of areas where more tests are needed:

1.) I'm not sure what public static String getFieldName(QueryParsing.StrParser sp) is for, but it's not covered at all.

2.) None of the logic related to collectingLiteral seems to be getting tested. I tried adjusting the test class to include a field list containing a function and a literal:

  @Test
  public void testFunctionAndLiteralInFieldList() {
	ReturnFields rf = new SolrReturnFields(req("fl", "ordOfId:{!func}ord(id),literal:1234"));
	assertTrue(rf.wantsField("ordOfId"));
	assertTrue(rf.wantsField("literal"));
	assertFalse(rf.wantsField("xxx"));
	assertFalse(rf.wantsAllFields());
  }

Unfortunately, while this test passes, it does not appear to affect the coverage as I had expected.

3.) For a little low-hanging-fruit coverage improvement, I added this to testFunkyFieldNames, since the method was not covered at all:

assertEquals("[#foo_s, id]", rf.getRequestedFieldNames().toString());

I'm not sure if that's actually valuable.

Apologies if any of these comments seem ill-informed; this is my first foray into the Solr code. However, we'd really like to see this patch committed to master, and I'm told that good patch test coverage helps things move along, so I thought I'd take a stab at it. I hope this is of some use! Please let me know if I can be of further assistance.

> field exclusion from fl
> -----------------------
>
>                 Key: SOLR-3191
>                 URL: https://issues.apache.org/jira/browse/SOLR-3191
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Luca Cavanna
>            Priority: Minor
>         Attachments: SOLR-3191.patch, SOLR-3191.patch, SOLR-3191.patch, SOLR-3191.patch
>
>
> I think it would be useful to add a way to exclude field from the Solr response. If I have for example 100 stored fields and I want to return all of them but one, it would be handy to list just the field I want to exclude instead of the 99 fields for inclusion through fl.



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