'Apply If condition in solr fieldlist

I need a variable value, which will compute the value on the basis of condition I have used.

I need to apply if condition and in case that condition exists I need to return the value as 1 else 0

My logic is:

{!field f=temp_close_timing v='[2022-03-11T11:14:39.667679 TO 2022-03-11T11:14:39.667679]'}

If we get the value from the above statement, we need to return true else return false.

I am not sure how to do this. I have tried exists condition here but I am not sure how to right the same in FL eg:

fl=if((exists({!field f=temp_close_timing v='[2022-03-11T11:14:39.667679 TO 2022-03-11T11:14:39.667679]'}),1,0),1,0)

but here I am getting error as "Error parsing fieldname: Expected identifier at pos 3 str="

I am not sure how to assign variable and if I assign variable that should be indexed separately.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source