SearchControl 数据对象

SearchControl 用于指定搜索标准。

SearchControl 数据对象的结构由以下内容组成:
countLimit
指定由搜索操作返回的搜索结果的最大数量。如果搜索结果的实际数量超过了指定的 countLimit,那么 SearchResponse 控件中的 hasMoreResults 属性会设置为 true。
注: 如果还使用了 PageControl,那么无法为 SearchControl 指定 countLimit 属性。它们是互斥的。
expression
指定 XPath 格式的搜索表达式。
properties
指定您要从与搜索标准匹配的实体中返回的属性。例如,您希望获取位于市场营销部门的个人的 sn 和 givenName 属性。
returnSubType
指定是否返回表达式中指定的实体的子类型。缺省设置为 true。
searchBases
指定搜索条件,用于将搜索限制为列表中指定这些条件。
searchLimit
指定可能由搜索操作返回的搜索结果的最大数量。如果搜索结果超过了 SearchControl 中指定的 searchLimit,或者 wimconfig.xml 文件中指定的 maxSearchResults 的更小数量,那么会抛出 MaxResultsExceededException。如果设置了 searchLimit,那么将忽略 countLimit。如果设置了 countLimit,那么 searchLimit 需要设置为 0。
timeLimit
如果概要文件存储库支持 timeLimit,那么此属性指定搜索的最长持续时间(以毫秒为单位)。

XML 模式定义

以下是 SearchControl 数据对象的 XML 模式定义:
<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>

样本数据对象

以下是 search API 中使用的一个样本 SearchControl 数据对象。它请求姓氏 (surname) 为 Doe 的所有人员。它还指示返回 uid 和 sn 属性(如果存在)。
<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>


使用条款 | 反馈