Tool to format the solr query for easier reading?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Tool to format the solr query for easier reading?

Hullegård, Jimi
Hi,

I often find myself having to analyze an already existing solr query. But when the number of clauses and/or number of nested parentheses reach a certain level I can no longer grasp what the query is about by just a quick glance. Sometimes I can look at the code generating the query, but it might be autogenerated in a complex way, or I might only have access to a log output of the query.

Here is an example query, based on a real query in our system:


system:(a) type:(x OR y OR z) date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])) -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))


Here I find it quite difficult to what clauses are grouped together (using parentheses). What I tend to do in these circumstances is to copy the query into a simple text editor, and then manually add line breaks and indentation matching the parentheses levels.

For the query above, it would result in something like this:


system:(a)
type:(x OR y OR z)
date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]
(
                             (boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])
)
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *]
(
                             ((*:* -date4:*) OR date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS])
)


But that is a slow process, and I might make a mistake that messes up the interpretation completely. Especially when there are several levels of nested parentheses.

Does anyone know of any kind of tool that would help automate this? It wouldn't have to format its output like my example, as long as it makes it easier to see what start and end parentheses belong to each other, preferably using multiple lines and indentation.

A java tool would be perfect, because then I could easily integrate it into our existing debugging tools, but an online formatter (like http://jsonformatter.curiousconcept.com) would also be very useful.

Regards
/Jimi

Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>
Reply | Threaded
Open this post in threaded view
|

Re: Tool to format the solr query for easier reading?

Charlie Hull-3
On 08/01/2019 04:33, Hullegård, Jimi wrote:
> Hi,

Hi Jimi,

There are some suggestions in part 4 of my recent blog:
http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/

Cheers

Charlie

>
> I often find myself having to analyze an already existing solr query. But when the number of clauses and/or number of nested parentheses reach a certain level I can no longer grasp what the query is about by just a quick glance. Sometimes I can look at the code generating the query, but it might be autogenerated in a complex way, or I might only have access to a log output of the query.
>
> Here is an example query, based on a real query in our system:
>
>
> system:(a) type:(x OR y OR z) date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])) -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>
>
> Here I find it quite difficult to what clauses are grouped together (using parentheses). What I tend to do in these circumstances is to copy the query into a simple text editor, and then manually add line breaks and indentation matching the parentheses levels.
>
> For the query above, it would result in something like this:
>
>
> system:(a)
> type:(x OR y OR z)
> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]
> (
>                               (boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])
> )
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *]
> (
>                               ((*:* -date4:*) OR date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS])
> )
>
>
> But that is a slow process, and I might make a mistake that messes up the interpretation completely. Especially when there are several levels of nested parentheses.
>
> Does anyone know of any kind of tool that would help automate this? It wouldn't have to format its output like my example, as long as it makes it easier to see what start and end parentheses belong to each other, preferably using multiple lines and indentation.
>
> A java tool would be perfect, because then I could easily integrate it into our existing debugging tools, but an online formatter (like http://jsonformatter.curiousconcept.com) would also be very useful.
>
> Regards
> /Jimi
>
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Reply | Threaded
Open this post in threaded view
|

SV: Tool to format the solr query for easier reading?

Hullegård, Jimi
Hi Charlie,

Care to elaborate on that a little? I can't seem to find any tool in that blog entry that formats a given solr query. What tool did you have in mind?

/Jimi

-----Ursprungligt meddelande-----
Från: Charlie Hull <[hidden email]>
Skickat: den 8 januari 2019 15:55
Till: [hidden email]
Ämne: Re: Tool to format the solr query for easier reading?

On 08/01/2019 04:33, Hullegård, Jimi wrote:
> Hi,

Hi Jimi,

There are some suggestions in part 4 of my recent blog:
http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/

Cheers

Charlie

>
> I often find myself having to analyze an already existing solr query. But when the number of clauses and/or number of nested parentheses reach a certain level I can no longer grasp what the query is about by just a quick glance. Sometimes I can look at the code generating the query, but it might be autogenerated in a complex way, or I might only have access to a log output of the query.
>
> Here is an example query, based on a real query in our system:
>
>
> system:(a) type:(x OR y OR z) date1:[* TO
> 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
> 2019-08-31T06:15:00Z/DAY-30DAYS]))
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
> date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>
>
> Here I find it quite difficult to what clauses are grouped together (using parentheses). What I tend to do in these circumstances is to copy the query into a simple text editor, and then manually add line breaks and indentation matching the parentheses levels.
>
> For the query above, it would result in something like this:
>
>
> system:(a)
> type:(x OR y OR z)
> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
>                               (boolean1:false OR date2:[* TO
> 2019-08-31T06:15:00Z/DAY-30DAYS])
> )
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
>                               ((*:* -date4:*) OR date5:* OR date3:[*
> TO 2019-08-31T06:15:00Z/DAY+1DAYS])
> )
>
>
> But that is a slow process, and I might make a mistake that messes up the interpretation completely. Especially when there are several levels of nested parentheses.
>
> Does anyone know of any kind of tool that would help automate this? It wouldn't have to format its output like my example, as long as it makes it easier to see what start and end parentheses belong to each other, preferably using multiple lines and indentation.
>
> A java tool would be perfect, because then I could easily integrate it into our existing debugging tools, but an online formatter (like http://jsonformatter.curiousconcept.com) would also be very useful.
>
> Regards
> /Jimi
>
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
> Här kan du läsa mer om vår behandling och dina rättigheter,
> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&ut
> m_medium=email>
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>
Reply | Threaded
Open this post in threaded view
|

Re: SV: Tool to format the solr query for easier reading?

Charlie Hull-3
On 08/01/2019 09:20, Hullegård, Jimi wrote:
> Hi Charlie,
>
> Care to elaborate on that a little? I can't seem to find any tool in that blog entry that formats a given solr query. What tool did you have in mind?

Hi Jimi,

I recalled that the Chrome plugin would do this, obviously it's not a
perfect solution for you as you've prefer a Java formatter but it's a
start - have you tried this one?

Best

Charlie

>
> /Jimi
>
> -----Ursprungligt meddelande-----
> Från: Charlie Hull <[hidden email]>
> Skickat: den 8 januari 2019 15:55
> Till: [hidden email]
> Ämne: Re: Tool to format the solr query for easier reading?
>
> On 08/01/2019 04:33, Hullegård, Jimi wrote:
>> Hi,
>
> Hi Jimi,
>
> There are some suggestions in part 4 of my recent blog:
> http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/
>
> Cheers
>
> Charlie
>>
>> I often find myself having to analyze an already existing solr query. But when the number of clauses and/or number of nested parentheses reach a certain level I can no longer grasp what the query is about by just a quick glance. Sometimes I can look at the code generating the query, but it might be autogenerated in a complex way, or I might only have access to a log output of the query.
>>
>> Here is an example query, based on a real query in our system:
>>
>>
>> system:(a) type:(x OR y OR z) date1:[* TO
>> 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS]))
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
>> date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>>
>>
>> Here I find it quite difficult to what clauses are grouped together (using parentheses). What I tend to do in these circumstances is to copy the query into a simple text editor, and then manually add line breaks and indentation matching the parentheses levels.
>>
>> For the query above, it would result in something like this:
>>
>>
>> system:(a)
>> type:(x OR y OR z)
>> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
>>                                (boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS])
>> )
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
>>                                ((*:* -date4:*) OR date5:* OR date3:[*
>> TO 2019-08-31T06:15:00Z/DAY+1DAYS])
>> )
>>
>>
>> But that is a slow process, and I might make a mistake that messes up the interpretation completely. Especially when there are several levels of nested parentheses.
>>
>> Does anyone know of any kind of tool that would help automate this? It wouldn't have to format its output like my example, as long as it makes it easier to see what start and end parentheses belong to each other, preferably using multiple lines and indentation.
>>
>> A java tool would be perfect, because then I could easily integrate it into our existing debugging tools, but an online formatter (like http://jsonformatter.curiousconcept.com) would also be very useful.
>>
>> Regards
>> /Jimi
>>
>> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
>> Här kan du läsa mer om vår behandling och dina rättigheter,
>> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
>> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&ut
>> m_medium=email>
>>
>
>
> --
> Charlie Hull
> Flax - Open Source Enterprise Search
>
> tel/fax: +44 (0)8700 118334
> mobile:  +44 (0)7767 825828
> web: www.flax.co.uk
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Reply | Threaded
Open this post in threaded view
|

Re: SV: Tool to format the solr query for easier reading?

Charlie Hull-3
In reply to this post by Hullegård, Jimi
On 08/01/2019 09:20, Hullegård, Jimi wrote:
> Hi Charlie,
>
> Care to elaborate on that a little? I can't seem to find any tool in that blog entry that formats a given solr query. What tool did you have in mind?

This also does some basic URL splitting:
https://www.freeformatter.com/url-parser-query-string-splitter.html

Cheers

Charlie

>
> /Jimi
>
> -----Ursprungligt meddelande-----
> Från: Charlie Hull <[hidden email]>
> Skickat: den 8 januari 2019 15:55
> Till: [hidden email]
> Ämne: Re: Tool to format the solr query for easier reading?
>
> On 08/01/2019 04:33, Hullegård, Jimi wrote:
>> Hi,
>
> Hi Jimi,
>
> There are some suggestions in part 4 of my recent blog:
> http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/
>
> Cheers
>
> Charlie
>>
>> I often find myself having to analyze an already existing solr query. But when the number of clauses and/or number of nested parentheses reach a certain level I can no longer grasp what the query is about by just a quick glance. Sometimes I can look at the code generating the query, but it might be autogenerated in a complex way, or I might only have access to a log output of the query.
>>
>> Here is an example query, based on a real query in our system:
>>
>>
>> system:(a) type:(x OR y OR z) date1:[* TO
>> 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS]))
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
>> date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>>
>>
>> Here I find it quite difficult to what clauses are grouped together (using parentheses). What I tend to do in these circumstances is to copy the query into a simple text editor, and then manually add line breaks and indentation matching the parentheses levels.
>>
>> For the query above, it would result in something like this:
>>
>>
>> system:(a)
>> type:(x OR y OR z)
>> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
>>                                (boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS])
>> )
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
>>                                ((*:* -date4:*) OR date5:* OR date3:[*
>> TO 2019-08-31T06:15:00Z/DAY+1DAYS])
>> )
>>
>>
>> But that is a slow process, and I might make a mistake that messes up the interpretation completely. Especially when there are several levels of nested parentheses.
>>
>> Does anyone know of any kind of tool that would help automate this? It wouldn't have to format its output like my example, as long as it makes it easier to see what start and end parentheses belong to each other, preferably using multiple lines and indentation.
>>
>> A java tool would be perfect, because then I could easily integrate it into our existing debugging tools, but an online formatter (like http://jsonformatter.curiousconcept.com) would also be very useful.
>>
>> Regards
>> /Jimi
>>
>> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
>> Här kan du läsa mer om vår behandling och dina rättigheter,
>> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
>> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&ut
>> m_medium=email>
>>
>
>
> --
> Charlie Hull
> Flax - Open Source Enterprise Search
>
> tel/fax: +44 (0)8700 118334
> mobile:  +44 (0)7767 825828
> web: www.flax.co.uk
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Reply | Threaded
Open this post in threaded view
|

SV: SV: Tool to format the solr query for easier reading?

Hullegård, Jimi
In reply to this post by Charlie Hull-3
I tried it now (but I had to install it from the official chrome store, the link from your blog didn't work). But the only formatting it seems to be doing is adding a line break after each "OR", which doesn't help much.

Although, to be fair, the plugin is still "Evaluating..." my query, so in theory I guess that it could do some more formatting when it is done (whenever that would be, it has been stuck in this "Evaluating..." for about 10 minutes now).

-----Ursprungligt meddelande-----
Från: Charlie Hull <[hidden email]>
Skickat: den 8 januari 2019 16:32
Till: [hidden email]
Ämne: Re: SV: Tool to format the solr query for easier reading?


Hi Jimi,

I recalled that the Chrome plugin would do this, obviously it's not a perfect solution for you as you've prefer a Java formatter but it's a start - have you tried this one?

Best

Charlie

>
> /Jimi
>
> -----Ursprungligt meddelande-----
> Från: Charlie Hull <[hidden email]>
> Skickat: den 8 januari 2019 15:55
> Till: [hidden email]
> Ämne: Re: Tool to format the solr query for easier reading?
>
> On 08/01/2019 04:33, Hullegård, Jimi wrote:
>> Hi,
>
> Hi Jimi,
>
> There are some suggestions in part 4 of my recent blog:
> http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-p
> art-4-tools/
>
> Cheers
>
> Charlie
>>
>> I often find myself having to analyze an already existing solr query. But when the number of clauses and/or number of nested parentheses reach a certain level I can no longer grasp what the query is about by just a quick glance. Sometimes I can look at the code generating the query, but it might be autogenerated in a complex way, or I might only have access to a log output of the query.
>>
>> Here is an example query, based on a real query in our system:
>>
>>
>> system:(a) type:(x OR y OR z) date1:[* TO
>> 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS]))
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
>> date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>>
>>
>> Here I find it quite difficult to what clauses are grouped together (using parentheses). What I tend to do in these circumstances is to copy the query into a simple text editor, and then manually add line breaks and indentation matching the parentheses levels.
>>
>> For the query above, it would result in something like this:
>>
>>
>> system:(a)
>> type:(x OR y OR z)
>> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
>>                                (boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS])
>> )
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
>>                                ((*:* -date4:*) OR date5:* OR date3:[*
>> TO 2019-08-31T06:15:00Z/DAY+1DAYS])
>> )
>>
>>
>> But that is a slow process, and I might make a mistake that messes up the interpretation completely. Especially when there are several levels of nested parentheses.
>>
>> Does anyone know of any kind of tool that would help automate this? It wouldn't have to format its output like my example, as long as it makes it easier to see what start and end parentheses belong to each other, preferably using multiple lines and indentation.
>>
>> A java tool would be perfect, because then I could easily integrate it into our existing debugging tools, but an online formatter (like http://jsonformatter.curiousconcept.com) would also be very useful.
>>
>> Regards
>> /Jimi
>>
>> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
>> Här kan du läsa mer om vår behandling och dina rättigheter,
>> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrit
>> e
>> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&u
>> t
>> m_medium=email>
>>
>
>
> --
> Charlie Hull
> Flax - Open Source Enterprise Search
>
> tel/fax: +44 (0)8700 118334
> mobile:  +44 (0)7767 825828
> web: www.flax.co.uk
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
> Här kan du läsa mer om vår behandling och dina rättigheter,
> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&ut
> m_medium=email>
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>
Reply | Threaded
Open this post in threaded view
|

Re: Tool to format the solr query for easier reading?

Jan Høydahl / Cominvent
In reply to this post by Hullegård, Jimi
I find myself doing exactly the same, so such a tool would be wonderful.
I sometimes use the Solr Query Debugger <https://chrome.google.com/webstore/detail/solr-query-debugger/gmpkeiamnmccifccnbfljffkcnacmmdl> Chrome plugin but that does not help with decoding the q parameter, only to more easily see all params and navigate explain.
And sometimes I use https://explain.solr.pl/explains/new <https://explain.solr.pl/explains/new> for decoding explain.
Lucene already parses the query string and builds a Lucene query, I wonder if it would be easiest to consume that Object graph with some kind of plugin to produce an indented view of the query. Or perhaps that could be a new display mode for debug=query as a standard feature?

Another option you have is of course to start sending your Solr queries as JSON DSL https://lucene.apache.org/solr/guide/7_6/json-query-dsl.html <https://lucene.apache.org/solr/guide/7_6/json-query-dsl.html> in the first place :)

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com <http://www.cominvent.com/>

> 8. jan. 2019 kl. 05:33 skrev Hullegård, Jimi <[hidden email] <mailto:[hidden email]>>:
>
> Hi,
>
> I often find myself having to analyze an already existing solr query. But when the number of clauses and/or number of nested parentheses reach a certain level I can no longer grasp what the query is about by just a quick glance. Sometimes I can look at the code generating the query, but it might be autogenerated in a complex way, or I might only have access to a log output of the query.
>
> Here is an example query, based on a real query in our system:
>
>
> system:(a) type:(x OR y OR z) date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])) -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>
>
> Here I find it quite difficult to what clauses are grouped together (using parentheses). What I tend to do in these circumstances is to copy the query into a simple text editor, and then manually add line breaks and indentation matching the parentheses levels.
>
> For the query above, it would result in something like this:
>
>
> system:(a)
> type:(x OR y OR z)
> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]
> (
>                             (boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])
> )
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *]
> (
>                             ((*:* -date4:*) OR date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS])
> )
>
>
> But that is a slow process, and I might make a mistake that messes up the interpretation completely. Especially when there are several levels of nested parentheses.
>
> Does anyone know of any kind of tool that would help automate this? It wouldn't have to format its output like my example, as long as it makes it easier to see what start and end parentheses belong to each other, preferably using multiple lines and indentation.
>
> A java tool would be perfect, because then I could easily integrate it into our existing debugging tools, but an online formatter (like http://jsonformatter.curiousconcept.com <http://jsonformatter.curiousconcept.com/>) would also be very useful.
>
> Regards
> /Jimi
>
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email <https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>>