mirror of https://github.com/apache/lucene.git
SOLR-3370: fixed CSVResponseWriter to respect globs in the 'fl' param
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1333760 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a8beeff4e9
commit
d90bbdb836
|
@ -405,6 +405,9 @@ Bug Fixes
|
||||||
CoreAdminHandler could return consistent information regardless of wether
|
CoreAdminHandler could return consistent information regardless of wether
|
||||||
there is a a default core name or not. (steffkes, hossman)
|
there is a a default core name or not. (steffkes, hossman)
|
||||||
|
|
||||||
|
* SOLR-3370: fixed CSVResponseWriter to respect globs in the 'fl' param
|
||||||
|
(Keith Fligg via hossman)
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -258,6 +258,10 @@ class CSVWriter extends TextResponseWriter {
|
||||||
CSVSharedBufPrinter csvPrinterMV = new CSVSharedBufPrinter(mvWriter, mvStrategy);
|
CSVSharedBufPrinter csvPrinterMV = new CSVSharedBufPrinter(mvWriter, mvStrategy);
|
||||||
|
|
||||||
for (String field : fields) {
|
for (String field : fields) {
|
||||||
|
if (!returnFields.wantsField(field)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (field.equals("score")) {
|
if (field.equals("score")) {
|
||||||
CSVField csvField = new CSVField();
|
CSVField csvField = new CSVField();
|
||||||
csvField.name = "score";
|
csvField.name = "score";
|
||||||
|
|
|
@ -164,6 +164,23 @@ public class TestCSVResponseWriter extends SolrTestCaseJ4 {
|
||||||
String s = buf.toString();
|
String s = buf.toString();
|
||||||
assertTrue(s.indexOf("score") >=0 && s.indexOf("2.718") > 0 && s.indexOf("89.83") > 0 );
|
assertTrue(s.indexOf("score") >=0 && s.indexOf("2.718") > 0 && s.indexOf("89.83") > 0 );
|
||||||
|
|
||||||
|
// Test field globs
|
||||||
|
rsp.setReturnFields( new ReturnFields("id,foo*", req) );
|
||||||
|
buf = new StringWriter();
|
||||||
|
w.write(buf, req, rsp);
|
||||||
|
assertEquals("id,foo_i,foo_s,foo_l,foo_b,foo_f,foo_d,foo_dt\n" +
|
||||||
|
"1,-1,hi,12345678987654321L,false,1.414,-1.0E300,2000-01-02T03:04:05Z\n" +
|
||||||
|
"2,,,,,,,\n",
|
||||||
|
buf.toString());
|
||||||
|
|
||||||
|
rsp.setReturnFields( new ReturnFields("id,*_d*", req) );
|
||||||
|
buf = new StringWriter();
|
||||||
|
w.write(buf, req, rsp);
|
||||||
|
assertEquals("id,foo_d,foo_dt\n" +
|
||||||
|
"1,-1.0E300,2000-01-02T03:04:05Z\n" +
|
||||||
|
"2,,\n",
|
||||||
|
buf.toString());
|
||||||
|
|
||||||
req.close();
|
req.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue