You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Angelo Veltens <a....@datingcafe.de> on 2015/05/19 15:32:44 UTC

Escaping special chars when exporting result sets

Hi all!

We use Solr 4.10.3 and have configured an /export SearchHandler in 
addition to the default SearchHandler /select.

<requestHandler name="/export" class="solr.SearchHandler">
   <lst name="invariants">
     <str name="rq">{!xport}</str>
     <str name="wt">xsort</str>
     <str name="distrib">false</str>
     <str name="fl">username,description</str>
    </lst>
   <arr name="components">
     <str>query</str>
   </arr>
</requestHandler>

The handler follows the example from section "Exporting Result Sets" of 
the user guide.

The description field may contain line breaks (\n) and quotation marks (").

When using the /select handler those characters are properly escaped. 
E.g. we get following value in the response:

"description":"Lorem ipsum\n\ndolor sit amet. \"hello\" world \" test....",

BUT when using the /export handler those characters are NOT escaped. We get:

"description":"Lorem ipsum

dolor sit amet. "hello" world " test...."

The latter is not valid JSON in our understanding.

What are we doing wrong? How can we get properly escaped JSON?

Thanks in advance!

Best regards,
Angelo Veltens







Re: Escaping special chars when exporting result sets

Posted by Angelo Veltens <a....@datingcafe.de>.
Am 20.05.15 um 00:36 schrieb Joel Bernstein:
> This should be considered a bug in the /export handler. Please create a
> jira ticket for this.
>

We have created a ticket:
https://issues.apache.org/jira/browse/SOLR-7647

Best regards,
Angelo

Re: Escaping special chars when exporting result sets

Posted by Joel Bernstein <jo...@gmail.com>.
This should be considered a bug in the /export handler. Please create a
jira ticket for this.

Thanks

Joel Bernstein
http://joelsolr.blogspot.com/

On Tue, May 19, 2015 at 2:32 PM, Angelo Veltens <a....@datingcafe.de>
wrote:

> Hi all!
>
> We use Solr 4.10.3 and have configured an /export SearchHandler in
> addition to the default SearchHandler /select.
>
> <requestHandler name="/export" class="solr.SearchHandler">
>   <lst name="invariants">
>     <str name="rq">{!xport}</str>
>     <str name="wt">xsort</str>
>     <str name="distrib">false</str>
>     <str name="fl">username,description</str>
>    </lst>
>   <arr name="components">
>     <str>query</str>
>   </arr>
> </requestHandler>
>
> The handler follows the example from section "Exporting Result Sets" of
> the user guide.
>
> The description field may contain line breaks (\n) and quotation marks (").
>
> When using the /select handler those characters are properly escaped. E.g.
> we get following value in the response:
>
> "description":"Lorem ipsum\n\ndolor sit amet. \"hello\" world \" test....",
>
> BUT when using the /export handler those characters are NOT escaped. We
> get:
>
> "description":"Lorem ipsum
>
> dolor sit amet. "hello" world " test...."
>
> The latter is not valid JSON in our understanding.
>
> What are we doing wrong? How can we get properly escaped JSON?
>
> Thanks in advance!
>
> Best regards,
> Angelo Veltens
>
>
>
>
>
>
>