[Yazlist] Yaz compatibility with solr >= 5.1

Dennis Schafroth dennis at schafroth.dk
Thu Jul 16 08:25:07 UTC 2015


I compiled yaz with the z_HTTP_header_add_content_type commented out. And searched using zoomsh against Solr 5.2.1 and it worked. 

Since there is no body, there is no need for a content-type. See 7.2.1 http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7>

The request could set a ACCEPT header with “application/xml”, but it’s not required to search against Solr 5.2.1. 

I did not manage to search and get JSON response back throw the stack (decode error). I don’t think yaz/ZOOM layer support JSON responses.

cheers, 
:-Dennis

> On 16 Jul 2015, at 09:48, Wolfram Schneider <wosch at freebsd.org> wrote:
> 
> On 15 July 2015 at 19:09, Marios Bartzokas <mbartzokas at atypon.com <mailto:mbartzokas at atypon.com>> wrote:
>> Hi,
>> 
>> We use metaproxy 1.8.10 with yaz 5.14.3 making requests to a solr index.
>> And we recently switched from solr 4.10.4 to 5.2.1.
>> 
>> This caused the requests from metaproxy to solr to fail with solr giving us
>> the following error:
>> HTTP 400 Bad Request -  Bad contentType for search handler :text/xml
>> 
>> Looking in metaproxy logs I see that a request to solr has the following
>> header;
>> Content-type: text/xml
>> 
>> By
>> 1) googling the issue and having found
>> http://lucene.472066.n3.nabble.com/Bad-contentType-for-search-handler-text-xml-charset-UTF-8-td4200314.html
>> 2) looking in the solr source code
> 
> it turns out that solr has problems with the standard content type "text/xml"
> 
>> we thought we should try using application/json as the Content-type in the
>> request headers.
> 
> please try instead "application/xml"
> 
> -Wolfram
> 
>> 
>> After many failed attempts to achieve that by using the metaproxy
>> http-rewrite filter, we changed the source code of yaz-5.14.3, file solr.c,
>> function yaz_solr_encode_request,
>> 
>> z_HTTP_header_add_content_type(encode, &hreq->headers,
>> "text/xml;application/json", charset);
>> 
>> to include the application/json in addition to text/xml.
>> 
>> This successfully changed the Content-Type and the request to solr now
>> succeeded.
>> 
>> We wanted 1) to report that and 2) to ask whether you think it is a good
>> solution or you would suggest another approach.
>> 
>> Best Regards,
>> Marios
> -- 
> Wolfram Schneider <wosch at FreeBSD.org <mailto:wosch at FreeBSD.org>> http://wolfram.schneider.org <http://wolfram.schneider.org/>
> 
> _______________________________________________
> Yazlist mailing list
> Yazlist at lists.indexdata.dk <mailto:Yazlist at lists.indexdata.dk>
> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist <http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.indexdata.dk/pipermail/yazlist/attachments/20150716/037f2503/attachment-0001.html>


More information about the Yazlist mailing list