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: Isn’t the FAQ label obsolete by now?
Answer: I think the problem is the reverse--the fact that FAQ lists are no longer actually lists of frequently asked questions. FAQs are still important, but all to often the FAQs are incredibly poorly written or just plain irrelevant. A new label won't fix that problem.