[
https://issues.apache.org/jira/browse/SOLR-5423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13894495#comment-13894495
]
Arun Kumar commented on SOLR-5423:
----------------------------------
Hi Hoss,
Thanks for your review. I have attached the patch generated at the root level
and followed the naming convention for the file.
Here are my inputs on your other comments:
The reason for including a new method getOriginalNameForFunctionField is the
ValueSourceAugmenter.getName() returns the name with a function prefix to it,
as like this.
public String getName()
{
return "function("+name+")";
}
We can't change this method directly as it has been referred in few other
places in the code, it may break other places. Even I thought of including a
new method in ValueSourceAugmenter as getOriginalName(){return name;} but for
this we have to change the abstract class DocTransformer and should implement
this new method in all the child classes which are extending DocTransformer. So
I dropped this option and wrote a method specific to CSVResponseWriter.
On number of instanceof used, in writeResponse method of CSVResponseWriter the
responseObj type is coming as ResultContext only when we have functions in the
query. so I am filtering the ResultContext instance and then the other two
instanceof is required when one function is present in the query then the
transformer type is of ValueSourceAugmenter and if we have multiple functions
in the same query then the transformer type is DocTransformers (array of
ValueSourceAugmenter) so we need to check these instanceof to process
accordingly. In general the transformer logic followed for xml/json is
different than the csv. In csv we don't have headers and the format also
simple. Because of this difference the transformers are not considering the
function field as a field for the csv type. Please let me know if there are any
other better way to handle this.
On the test case, yes I can write a unit test case to prove this fix works.
Thanks,
Arun
> CSV output doesn't include function field
> -----------------------------------------
>
> Key: SOLR-5423
> URL: https://issues.apache.org/jira/browse/SOLR-5423
> Project: Solr
> Issue Type: Bug
> Affects Versions: 4.4
> Reporter: James Wilson
> Attachments: SOLR-5423.patch
>
>
> Given a schema with
> <field name="price" type="float" indexed="true" stored="true"/>
> <field name='numpages' type='int' indexed='true' stored='true'/>
>
> the following query returns no rows:
> http://localhost:8983/solr/collection1/select?q=*%3A*&rows=30&fl=div(price%2Cnumpages)&wt=csv&indent=true
> However, setting wt=json or wt=xml, it works.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]