Only for the records, I will describe here what I did to solve this
problem. This is specific for those who are using python/requests and Solr
json facet api.


I would like to ask another question regarding json facet.
>
> With GET method, i was used to use many fq on the same query, each one
> with it's own tag. It was working wondefully.
>
> With POST method, to post more than one fq parameter is a little
> complicated, so I am joining all queries in one fq with all the tags. When
> I select the first facet everything seems to be ok, but when I select the
> second facet it is "cleaning" the first filter for the facets which shows
> all the original values for this second facet, even though the result-set
> is filtering as expected. I will make more tests to understand the
> mechanics of this, but if someone has some advise on this subject I
> appreciate a lot.
>


I was not aware how to POST data with same key on Python. It was due to my
unfamiliarity of the details of the protocol and the libs.
In python/requests library, one way to send data over POST is to use a
dictionary, that has a unique key by design.

But I realise that I can send data as a list of tuples like this:
[('q','*:*'), ('fl','*'), ('json.facet',facet_fields), ('fq', 'fq_1'),
'fq', 'fq_2'),  'fq', 'fq_3')]

The facet layer of my system now works entirely  using solr json facet api
over http post.












>
>
>
>
> 2018-05-08 23:54 GMT-03:00 Yonik Seeley <ysee...@gmail.com>:
>
>> Looks like some sort of proxy server inbetween the python client and
>> solr server.
>> I would still check first if the output from the python client is
>> correctly escaped/encoded HTTP.
>>
>> One easy way is to use netcat to pretend to be a server:
>> $ nc -l 8983
>> And then send point the python client at that and send the request.
>>
>> -Yonik
>>
>>
>> On Tue, May 8, 2018 at 9:17 PM, Kojo <rbsnk...@gmail.com> wrote:
>> > Thank you all. I tried escaping but still not working
>> >
>> > Yonik, I am using Python Requests. It works if my fq is a single word,
>> even
>> > if I use double quotes on this single word without escaping.
>> >
>> > This is the HTTP response:
>> >
>> > response.content
>> > <Response [400]>
>> > '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML
>> > 2.0//EN">\n<html><head>\n<title>400 Bad
>> > Request</title>\n</head><body>\n<h1>Bad Request</h1>\n<p>Your browser
>> sent
>> > a request that this server could not understand.<br
>> > />\n</p>\n<hr>\n<address>Apache/2.2.15 (Oracle) Server at leydenh Port
>> > 80</address>\n</body></html>\n'
>> >
>> >
>> > Thank you,
>> >
>> >
>> >
>> > 2018-05-08 18:46 GMT-03:00 Yonik Seeley <ysee...@gmail.com>:
>> >
>> >> On Tue, May 8, 2018 at 1:36 PM, Kojo <rbsnk...@gmail.com> wrote:
>> >> > If I tag the fq query and I query for a simple word it works fine
>> too.
>> >> But
>> >> > if query a multi word with space in the middle it breaks:
>> >>
>> >> Most likely the full query is not getting to Solr because of an HTTP
>> >> protocol error (i.e. the request is not encoded correctly).
>> >> How are you sending your request to Solr (with curl, or with some other
>> >> method?)
>> >>
>> >> -Yonik
>> >>
>>
>
>

Reply via email to