private function buildConstraintsBox(PhabricatorApplicationSearchEngine $engine)
    {
        $info = pht(<<<EOTEXT
You can apply custom constraints by passing a dictionary in `constraints`.
This will let you search for specific sets of results (for example, you may
want show only results with a certain state, status, or owner).


If you specify both a `queryKey` and `constraints`, the builtin or saved query
will be applied first as a starting point, then any additional values in
`constraints` will be applied, overwriting the defaults from the original query.

Specify constraints like this:

```lang=json, name="Example Custom Constraints"
{
  ...
  "constraints": {
    "authors": ["PHID-USER-1111", "PHID-USER-2222"],
    "statuses": ["open", "closed"],
    ...
  },
  ...
}
```

This API endpoint supports these constraints:
EOTEXT
);
        $fields = $engine->getSearchFieldsForConduit();
        // As a convenience, put these fields at the very top, even if the engine
        // specifies and alternate display order for the web UI. These fields are
        // very important in the API and nearly useless in the web UI.
        $fields = array_select_keys($fields, array('ids', 'phids')) + $fields;
        $rows = array();
        foreach ($fields as $field) {
            $key = $field->getConduitKey();
            $label = $field->getLabel();
            $type_object = $field->getConduitParameterType();
            if ($type_object) {
                $type = $type_object->getTypeName();
                $description = $field->getDescription();
            } else {
                $type = null;
                $description = phutil_tag('em', array(), pht('Not supported.'));
            }
            $rows[] = array($key, $label, $type, $description);
        }
        $table = id(new AphrontTableView($rows))->setHeaders(array(pht('Key'), pht('Label'), pht('Type'), pht('Description')))->setColumnClasses(array('prewrap', 'pri', 'prewrap', 'wide'));
        return id(new PHUIObjectBoxView())->setHeaderText(pht('Custom Query Constraints'))->setCollapsed(true)->appendChild($this->buildRemarkup($info))->appendChild($table);
    }