lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: Solr Json Facet
Date Tue, 08 May 2018 21:39:56 GMT
On 5/8/2018 11:36 AM, Kojo 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:
> {'q':'*:*', 'fl': '*',
> 'fq':'{!tag=city_colaboration_tag}city_colaboration:"College
> Station"', 'json.facet': '{city_colaboration:{type:terms, field:
> city_colaboration ,limit:5000, domain:{excludeTags:city_
> colaboration_tag}}}'}

Best guess is that this is happening because your JSON fails
validation.  One of the rules is that quotes must be escaped if you want
to use a literal quote.

Putting your JSON into a validator, it gets flagged with a BUNCH of errors.

I think I managed to fix it.  Here's a new version that passes strict
validation.  The paste will expire one month from now:

I also fixed/validated the inner json in the json.facet parameter before
I escaped it.  As you can see, nested json is messy when it is correctly

This is the tool I used for the escaping:

Development libraries for constructing JSON data would probably handle
the escaping automatically.

The JSON parser that Solr uses can handle some deviations from the
strict standard, but not ALL deviations.  Using data that passes strict
validation will make success more likely.  It's not what I would do, but
you could probably also get this working just by escaping the quotes
around the query text:
\"College Station\"


View raw message