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.

https://jsonformatter.curiousconcept.com/

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

https://apaste.info/M46c

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
formed.

This is the tool I used for the escaping:

https://codebeautify.org/json-escape-unescape

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\"

Thanks,
Shawn

Reply via email to