10.11.1 ProblemYou want to index an attribute so that searches using that attribute are faster. 10.11.2 Solution
10.11.2.1 Using a graphical user interface
10.11.2.2 Using a command-line interfaceYou can index an attribute by using the ldifde utility and an LDIF file that contains the following: dn: cn=<AttrCommonName>,cn=schema,cn=configuration,<ForestRootDN> changetype: modify replace: searchFlags searchFlags: 1 - If the LDIF file were named index_attribute.ldf, you would run the following command: > ldifde -v -i -f index_attribute.ldf 10.11.2.3 Using VBScript' This code indexes an attribute. ' ------ SCRIPT CONFIGURATION ------ ' Set to the common name (not LDAP display name) of the attribute strAttrName = "<AttrCommonName>" ' e.g. rallencorp-LanguagesSpoken ' ------ END CONFIGURATION --------- set objRootDSE = GetObject("LDAP://RootDSE") set objAttr = GetObject("LDAP://cn=" & strAttrName & "," & objRootDSE.Get("schemaNamingContext")) objAttr.Put "searchFlags", 1 objAttr.SetInfo WScript.Echo "Indexed attribute: " & strAttrName
10.11.3 DiscussionTo index an attribute, you need to enable the 1 bit (0001) in the searchFlags attribute for the attributeSchema object. searchFlags is a bit flag attribute that is used to set various properties related to searching with the attribute. Table 10-5 contains the various bit flags that can be set with searchFlags. When setting searchFlags, you may often need to set a couple bits together. For example, all Ambiguous Name Resolution (ANR) attributes must also be indexed, which means searchFlags should be set to 5 (1 + 4). You can find the attributes that are indexed in the schema by using the following search criteria:
Alternatively, to find attributes that aren't indexed, change the previous search filter to the following: (&(objectcategory=attributeSchema)(!(searchFlags:1.2.840.113556.1.4.803:=1))) 10.11.4 See AlsoRecipe 4.12 for modifying a bit-flag attribute, Recipe 10.7 for adding a new attribute, and MS KB 243311 (Setting an Attribute's searchFlags Property to Be Indexed for ANR) |