You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Chris A. Mattmann (JIRA)" <ji...@apache.org> on 2010/07/15 00:30:50 UTC
[jira] Commented: (SOLR-1925) CSV Response Writer
[ https://issues.apache.org/jira/browse/SOLR-1925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888581#action_12888581 ]
Chris A. Mattmann commented on SOLR-1925:
-----------------------------------------
Hi Tommy:
{quote}
I fixed the path of the queryResponseWriter class in the example solrconfig.xml. This was successfully applied against solr 4.0 trunk.
{quote}
What does "fixing the path" mean?
Onto your comments below:
{quote}
* When I didn't specify a default Delimiter, it printed out null as delimiter. I couldn't figure out why because init(NamedList args) specifies it'll use a default of "," "organization"null"2"null"
{quote}
It didn't do that for me? Where did you initialize your response writer? Note that the patch I attached included updates to solrconfig.xml, where the default delimeter is provided as an initParam.
{quote}
* If i don't specify the column names, the output doesn't put in empty "" correctly. eg: output has a mismatched number of commas. "organization","1","Test","Name","2"," ","2000000","8", "organization","4","Solar","4","0",
{quote}
Yep that's the intention. It's because Lucene/Solr documents can have an arbitrary # of fields in them. I saw no good, intuitive way to overcome this, so unless you tell me what the default field name list is, the writer won't do anything special (b/c I believe to do so would be somewhat limiting and non-generic), and it will simply output the fields that are in the doc, which, can be a non-uniform number, causing what you're seeing. To say that's not correct, well, I don't agree with that.
I tried diffing your latest patch against my latest:
{noformat}
[chipotle:~/Desktop/Apache/solr-dev] mattmann% diff -u SOLR-1925.Chheng.071410.patch.txt SOLR-1925.Mattmann.061110.patch.txt
--- SOLR-1925.Chheng.071410.patch.txt 2010-07-14 15:22:57.000000000 -0700
+++ SOLR-1925.Mattmann.061110.patch.txt 2010-06-11 20:34:58.000000000 -0700
@@ -1,3 +1,5 @@
+### Eclipse Workspace Patch 1.0
+#P solrcene
Index: solr/src/java/org/apache/solr/response/CSVResponseWriter.java
===================================================================
--- solr/src/java/org/apache/solr/response/CSVResponseWriter.java (revision 0)
@@ -259,7 +261,7 @@
<int name="xsltCacheLifetimeSeconds">5</int>
</queryResponseWriter>
+
-+ <queryResponseWriter name="csv" class="org.apache.solr.response.CSVResponseWriter">
++ <queryResponseWriter name="csv" class="solr.CSVResponseWriter">
+ <str name="delimiter">,</str>
+ <!-- this specifies that
+ you are writing CSV that you expect to load into M$
@@ -290,7 +292,6 @@
m.put("raw", new RawResponseWriter());
m.put("javabin", new BinaryResponseWriter());
+ m.put("csv", new CSVResponseWriter());
- m.put("velocity", new VelocityResponseWriter());
DEFAULT_RESPONSE_WRITERS = Collections.unmodifiableMap(m);
}
[chipotle:~/Desktop/Apache/solr-dev] mattmann%
{noformat}
All you did was use the virtual solr package resolution string, versus using the FQDN for the class. Either one works fine. Also, I'm not sure I get the removing velocity from the default response writer map part...
Cheers,
Chris
> CSV Response Writer
> -------------------
>
> Key: SOLR-1925
> URL: https://issues.apache.org/jira/browse/SOLR-1925
> Project: Solr
> Issue Type: New Feature
> Components: Response Writers
> Environment: indep. of env.
> Reporter: Chris A. Mattmann
> Assignee: Erik Hatcher
> Fix For: Next
>
> Attachments: SOLR-1925.Chheng.071410.patch.txt, SOLR-1925.Mattmann.053010.patch.2.txt, SOLR-1925.Mattmann.053010.patch.3.txt, SOLR-1925.Mattmann.053010.patch.txt, SOLR-1925.Mattmann.061110.patch.txt
>
>
> As part of some work I'm doing, I put together a CSV Response Writer. It currently takes all the docs resultant from a query and then outputs their metadata in simple CSV format. The use of a delimeter is configurable (by default if there are multiple values for a particular field they are separated with a | symbol).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org