> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# search:conditional

[localhost link]: http://localhost:3000/docs/4/app-studio/reference/tags/lightning.directive.searchConditional

[mintlify link]: https://doc.lucidworks.com/docs/4/app-studio/reference/tags/lightning.directive.searchConditional.md

[old doc.lw link]: https://doc.lucidworks.com/app-studio/4.2/1143.md

> [card] Key questions to get you started
>
> Powered by Lucidworks Agent Studio

## Description

The search conditional directive

## Usage

as element:

```xml wrap  theme={"dark"}
<search:conditional
       [test="{string}"]
       [response="{object}"]>
</search:conditional>
```

### Directive info

* This directive creates new scope.

#### Parameters

| Param | Type | Details |
| - | - | - |
| test  *(optional)* | **string** | The expression to test conditional logic for. Only render the contents tag if this evaluates to true. |
| response  *(optional)* | **object** | A Response object to check, the tag will render the body if the Response is not null. |

## Example

#### Source

```xml wrap  expandable  theme={"dark"}
<h3 id="example_test-attribute">Test Attribute</h3>
<search:conditional test="test1 > 100">
    <p>False don't display</p>
</search:conditional>

<search:conditional test="test1 >= 100">
    <p>True! test1 is greater than or equal to 100</p>
</search:conditional>

<search:conditional test="test2">
    <p>True! test2 is true</p>
</search:conditional>

<search:conditional test="test3 == 'Foo'">
    <p>False don't display</p>
</search:conditional>

<search:conditional test="test3 == 'foo'">
    <p>True test3 does equal foo</p>
</search:conditional>

<hr/>

<h3 id="example_response-attribute">Response Attribute</h3>

<search:conditional response="response">
    <p>True! Response does exist.</p>
</search:conditional>

<search:conditional response="response2">
    <p>False! Response2 does not exist.</p>
</search:conditional>
```

```js wrap  theme={"dark"}
angular.module('lightning')
.controller('ExampleController', ['$scope','ResponseService', function($scope,ResponseService) {
            $scope.test1 = 100;
            $scope.test2 = true;
            $scope.test3 = 'foo'

            ResponseService.setResponse('response', {foo:'bar'});
        }]);
```

#### Result

![Result](https://mintcdn.com/lucidworks/ENcE8K39c0iEpL8J/assets/images/app-studio/as-examples/tags/searchConditional.png?fit=max\&auto=format\&n=ENcE8K39c0iEpL8J\&q=85\&s=8f4e1294b98871c1fd9b368f72f6b735)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.