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

# Sample 2. Step 7: Testing the identifier element

> Test the FormHeader identifier element by matching the FlexiLayout with each image, and then add a NearestY pre-search constraint to rule out false matches.

To check that the program can reliably detect the identifier element **FormHeader**, try matching the FlexiLayout with each image in the batch:

<Steps>
  <Step title="Open each image">
    Open the sample images in the batch one at a time.
  </Step>

  <Step title="Match the FlexiLayout with the image">
    Select the **Match** command on the **FlexiLayout** menu or the shortcut menu of the image.
  </Step>
</Steps>

If the image and its FlexiLayout have been matched successfully, the hypothesis that the program formulates about the **FormHeader** element is marked with <img src="https://mintcdn.com/abbyy/lqYknuOmCa79141v/images/flexi-capture/fls/hyp_best.gif?s=eef1d527150e4c2f5739a72cfbd7ffd5" alt="Best hypothesis icon" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="15" height="16" data-path="images/flexi-capture/fls/hyp_best.gif" /> in the **Tree of Hypotheses**. If you click the hypothesis, the program draws a blue frame around the detected element. The properties of the hypothesis appear in the **Properties** window.

<Frame>
  <img src="https://mintcdn.com/abbyy/r-nfa7jujx5b9gKX/images/flexi-capture/fls/tutorial2_8.png?fit=max&auto=format&n=r-nfa7jujx5b9gKX&q=85&s=1482e4c97117344a6b2453fa30bebbe3" alt="Screenshot of the ABBYY FlexiLayout Studio editor showing a matched recipe document with the FormHeader element drawn around the Easiest Recipes heading and the FormHeader hypothesis selected in the Tree of Hypotheses." width="556" height="384" data-path="images/flexi-capture/fls/tutorial2_8.png" />
</Frame>

When you try matching the FlexiLayout with the images, you see that on some of the images the program finds a part of the phrase above the document heading instead of the heading itself. The phrase "Enjoy our collection of easiest recipes from over 50 countries of the world" occurs on almost all the images in the batch. To prevent the program from mistaking this phrase for the document heading, you must adjust the properties of the identifier element. Since the phrase "Enjoy our collection…" is always located above the document heading, the program must look for an object that has all the properties specified by the element and is located closest to the bottom edge of the image.

To specify additional search constraints:

<Steps>
  <Step title="Open the Advanced tab of the FormHeader properties">
    Open the **Properties** dialog box for the **FormHeader** element, and then click the **Advanced** tab.
  </Step>

  <Step title="Add the search constraint">
    In the **Advanced pre-search relations** field, specify an [additional search constraint](/flexi-capture/fls/template/advanced-constraints) that looks for the object closest to the bottom edge of the image. In the [FlexiLayout language](/flexi-capture/fls/code/general-code), enter `NearestY: PageRect.Bottom;`.
  </Step>
</Steps>

<Note>
  You can also specify the same constraint through the program's graphical user interface. Click the **Relations** tab, select **Nearest**, and in the **To:** dropdown list select **Page bottom edge**.
</Note>

<Note>
  The **Nearest** function tells the program that, out of several hypotheses for the element, it should look for the one nearest to a particular other element or point on the image (the distance between element centers is measured). Once the function is executed, only one hypothesis remains. This function does not take into account the quality of the hypotheses, as the choice is made at the stage when hypotheses are still being generated.
</Note>

Once you match the FlexiLayout with the images again, you see that the program reliably detects the document headings described by the **FormHeader** element on all the test images.
