Browsing indexes are special indexes used only for search operations that request server-side sorting of results. Sun Java System Directory Server Enterprise Edition 6.0 Reference explains how browsing indexes work in Directory Server.
Customized browsing indexes for sorting client search results must be defined manually. To create a browsing index, or virtual list view (VLV) index, use the following procedure. This section also includes procedures for adding or modifying browsing index entries and for regenerating browsing indexes.
For parts of this procedure, you can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help. Other parts of the procedure can only be done using the command line.
Add new browsing index entries or edit existing browsing index entries by using the ldapmodify command.
For instructions, see To Add or Modify Browsing Index Entries.
Run the dsconf reindex command to generate the new set of browsing indexes to be maintained by the server.
For instructions, see To Regenerate Browsing Indexes.
A browsing index is specific to a given search on a given base entry and its subtree. The browsing index configuration is defined in the database configuration of the suffix that contains the entry.
Configure the vlvBase, vlvScope, and vlvFilter attributes for each browsing index on a directory server.
These attributes configure the base of the search, the scope of the search, and a filter for the search. These attributes use the vlvSearch object class.
Configure the vlvSort attribute for each browsing index.
This attribute specifies the name of the attribute or attributes that sort the index. This entry is a child of the first entry and uses the vlvIndex object class to specify which attributes to sort and in what order.
The following example uses the ldapmodify command to create the browsing index configuration entries:
$ ldapmodify -a -h host -p port -D cn=admin,cn=Administrators,cn=config -w - dn: cn=people_browsing_index, cn=database-name, cn=ldbm database,cn=plugins,cn=config objectClass: top objectClass: vlvSearch cn: Browsing ou=People vlvBase: ou=People,dc=example,dc=com vlvScope: 1 vlvFilter: (objectclass=inetOrgPerson) dn: cn=Sort rev employeenumber, cn=people_browsing_index, cn=database-name,cn=ldbm database,cn=plugins,cn=config objectClass: top objectClass: vlvIndex cn: Sort rev employeenumber vlvSort: -employeenumber ^D
The vlvScope is one of the following:
0 for the base entry alone
1 for the immediate children of the base
2 for the entire subtree rooted at the base
The vlvFilter is the same LDAP filter that is used in the client search operations. Because all browsing index entries are located in the same place, you should use descriptive cn values to name your browsing indexes.
Each vlvSearch entry must have at least one vlvIndex entry. The vlvSort attribute is a list of attribute names that defines the attribute to sort on and the sorting order. The dash ( -) in front of an attribute name indicates reverse ordering. You can define more than one index for a search by defining several vlvIndex entries. With the previous example, you could add the following entry:
$ ldapmodify -a -h host -p port -D cn=admin,cn=Administrators,cn=config -w - dn: cn=Sort sn givenname uid, cn=people_browsing_index, cn=database-name,cn=ldbm database,cn=plugins,cn=config objectClass: top objectClass: vlvIndex cn: Sort sn givenname uid vlvSort: sn givenname uid ^D
To modify a browsing index configuration, edit the corresponding vlvSearch entry or the corresponding vlvIndex entry.
To remove a browsing index so that the browsing index is no longer maintained by the server, remove the individual vlvIndex entries.
Alternatively, if only one vlvIndex entry exists, remove both the vlvSearch entry and the vlvIndex entry.
After you have created the browsing index entries, generate the new browsing indexes for the attributes specified.
$ dsadm reindex -l -t attr-index instance-path suffix-DN
The command scans the directory contents and creates a database file for the browsing index.
The following example generates the browsing index that you defined in the previous section:
$ dsadm reindex -l -b database-name -t Browsing /local/ds \ ou=People,dc=example,dc=com
For more information about the dsadm reindex command, see the dsadm(1M) man page.