> ## 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.

# Search constraints

> Set search constraints in the Advanced pre-search relations section using RestrictSearchArea, half-plane functions, boundary limits, and exclusions.

Search area constraints are set on the **Search Constraints** and **Relations** tabs in the **Properties** dialog box, and in the **Advanced pre-search relations** section.

Before any constraints are applied, the search area coincides with the rectangle of the page. FlexiLayout Studio first applies the constraints set on the **Search Constraints** and **Relations** tabs, and then applies the additional constraints set in the **Advanced pre-search relations** section.

## Advanced pre-search relations constraint types

You can set the following types of constraint:

* **Rectangle, region, or array of rectangles** – Limit the search area to a rectangle (`Rect` variable), to a region (that is, a continuous array of rectangles, `Region` variable), or to an array of rectangles that need not be continuous in the general case (`RectArray` variable). Set this constraint with the `RestrictSearchArea` function and a parameter of the corresponding type. Any expression that returns a value of the required type can be used as a parameter.
* **Half-plane** – Limit the search area to a half-plane located to the left of, to the right of, above, or below a particular point. Set these constraints with the `Leftof`, `Rightof`, `Above`, and `Below` functions.
* **Element boundary** – Constrain an individual boundary of an element, which narrows the range of possible hypotheses at the stage of calculating the search area. Set these constraints with the `LeftBound`, `RightBound`, `topBound`, and `BottomBound` functions and the `>` and `<` operators.
* **Exclusion** – Exclude a rectangle, an array of rectangles, a hypothesis, and so on from the search area. Set these constraints with the `Exclude`, `ExcludeRect`, and `ExcludeSet` functions.

For element boundary constraints, you may know beforehand that the left boundary of an element is always located in the left-hand part of the image, whereas the right boundary may stretch indefinitely to the right. The `LeftBound` and `RightBound` functions access the left and right boundaries of the search area, and the `topBound` and `BottomBound` functions access the top and bottom boundaries respectively.

## How multiple constraints combine

You can specify any number of these constraints in the **Advanced pre-search relations** section. Each constraint creates a region on the image, and all the regions created by the constraints are intersected.

Additionally, the calculated search area for the element is intersected with the search area for the **Group** element that contains this element.
