I have this opening low search result tag

{exp:low_search:results
  {if segment_2}query="{segment_2}"{/if}
  group_id="7"
  limit="4"
  paginate="bottom"
}


I wanted to do more checks on segment_2 before deciding if I should set query param(checking if the segment is for pagination such as P1 or P4).

{exp:low_search:results
    {if segment_2 == '' OR {exp:segment_search keyword="/^P\d+$/" segments="2" regex="yes"}}{if:else}query="{segment_2}"{/if}
     group_id="7"
     limit="4"
     paginate="bottom"
}


However, I don't think this will work. I think it has something to do with the parse order where you can't set complex conditionals inside a tag.

If so, is there an alternative way to set the query param?

UPDATE: The reason I am asking is because the code below does not work

{if {segment_2} == '' OR {exp:segment_search keyword="/^P\d+$/" segments="2" regex="yes"}}
    {exp:low_search:results
        {if segment_1 == "foo"}group_id="6"{/if}
        {if segment_1 == "bar"}group_id="7"{/if}
        limit="4"
        paginate="bottom"}
{if:else}
    {exp:low_search:results
        query="{segment_2}"
        {if segment_1 == "foo"}group_id="6"{/if}
        {if segment_1 == "bar"}group_id="7"{/if}
        limit="4"
        paginate="bottom"}
{/if}


I always get a Parse error: syntax error, unexpected T_ELSE in the code where I don't set the query param.


Question: How to use Java to read/write data to/from the header pins?
Answer: If you did not already foud your solution, the Pi4J Library, based on Wiring for the Raspberry Pi, offers - also on an early development stage - acces to GPIO, I2C and SPI. And Rs232, not to forget!

Serviceprovider for several IO-boards (Olimex etc.) are included. 

Most interesting: Event driven processing (GPIO-Interrupts).

see:  http://pi4j.com

rgds