SearchControl is used to specify the search criteria.
The structure of a SearchControl data object consists of:
- countLimit
- specifies the maximum number of search results returned by the search
operation. If the actual number of search results is more than the specified
countLimit, the hasMoreResults property in the SearchResponse control is
set to true.
Note: The countLimit property cannot be specified for SearchControl,
if PageControl is also used. They are mutually exclusive.
- expression
- specifies search expression in XPath format.
- properties
- specifes the properties that you want returned from the entities that
match the search criteria. For example, you want to get the sn and givenName
attributes of the persons who is in marketing department.
- returnSubType
- specifies whether to return the subtypes of the entities specified in
the expression. The default setting is true.
- searchBases
- specifies the search bases used to limit the search to those bases specified
in the list.
- searchLimit
- specifies the maximum number of search results that may be returned by
the search operation. If the search results exceeds the smaller number of
either searchLimit specified in SearchControl or maxSearchResults specified
in the wimconfig.xml file, a MaxResultsExceededException is thrown.If searchLimit
is set then countLimit is ignored. If countLimit is set then searchLimit needs
to be set to 0.
- timeLimit
- If the profile repository supports timeLimit, it specifies in milliseconds
the maximum duration of the search.
XML schema definition
The following is the XML schema
definition for the SearchControl data object:
<xsd:complexType name="SearchControl">
<xsd:complexContent>
<xsd:extension base="PropertyControl">
<xsd:sequence>
<xsd:element name="searchBases" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="countLimit" type="xsd:int" />
<xsd:attribute name="searchLimit" type="xsd:int" />
<xsd:attribute name="timeLimit" type="xsd:int" default="0"/>
<xsd:attribute name="expression" type="xsd:string"/>
<xsd:attribute name="returnSubType" type="xsd:boolean" default="true"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Sample data object
Following is a sample SearchControl
DataObject used in the search API. It requests all the persons who have the
last name (surname), Doe. It also indicates to return the uid and sn properties
if they exist.
<wim:controls xsi:type="wim:SearchControl" countLimit="1"
expression="@xsi:type='PersonAccount' and sn='Doe'">
<wim:properties>uid</wim:properties>
<wim:properties>sn</wim:properties>
<wim:searchBases>o=Sales,cn=users,dc=yourco,dc=com</wim:searchBases>
</wim:controls>