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

# Advanced post-search relations

> Advanced post-search relations penalize generated hypotheses in FlexiLayout code, checking element properties and adjusting quality with Quality(q).

Advanced post-search relations allow you to penalize a generated hypothesis depending on the properties of the element. The purpose of these constraints is to adjust an already generated hypothesis.

<Info>
  The major difference between Advanced post-search relations and [Advanced pre-search relations](/flexi-capture/fls/template/advanced-pre-search) is that the program starts to consider the post-search relations only after the hypothesis has been formulated.
</Info>

<Note>
  Do not write the name of the element in the code of the **Advanced post-search relations**. For example, to access the `Width` property of some `Element1`, write only `Width`.
</Note>

Constraints set in the **Advanced post-search relations** pane are applied to each formulated hypothesis of the element independently of the other hypotheses. Different hypotheses for the same element cannot be compared. You can only adjust the quality of a specific hypothesis by studying its properties and imposing certain constraints on it.

Any command or constraint in the **Advanced post-search relations** pane returns an estimate of the quality of the hypothesis for the given element. Estimates obtained by applying different constraints are multiplied.

<Note>
  Additional constraints set on the **Advanced** tab in the **Advanced post-search relations** pane can only refer to the current element and the elements located above the current element in the FlexiLayout tree. If this condition is not met, the program highlights the invalid element.
</Note>

You can use the **Advanced post-search relations** pane to apply constraints to a hypothesis, check its properties, and adjust its quality.

## Apply constraints to the properties of a hypothesis

A constraint such as `Width > 5*cm` returns a quality of 0 for a hypothesis that is 3 cm long, which causes the program to stop formulating hypotheses for the element and its subelements.

## Check the properties of a hypothesis

The following condition checks the height of the hypothesis and, depending on the result, limits or adjusts its width:

```text theme={null}
if Height > 3*cm then Width > 5*cm;
```

## Adjust the quality of a hypothesis

You can adjust the quality of a hypothesis by calling the `Quality(q)` function, where `q` is a variable of type `Quality`. Executing this command multiplies the quality of the hypothesis by `q`.

<Warning>
  Use of this feature requires caution. Do not use it if you are not sure of the results.
</Warning>
