Searching the directory tree

his chapter describes the two types of searching you can use from the Directory Server interface. Search results are also described in this chapter.

The two types of searching you can perform are:

Smart Search

Smart search provides an intelligent searching mechanism that performs different types of searches depending upon the nature of the data that you specify. That is, depending on what you type in the search field, Smart Search attempts to find matching names, telephone numbers, or e-mail addresses.

Furthermore, based on what you enter, Smart Search determines whether to find entries that exactly match your criteria, entries that contain your criteria, or entries that contain words that sound like your criteria. You can also provide an actual LDAP search filter to the Smart Search field, and that filter will be used in the search.

The Find: field

The Find: field defines the types of entries for which you are searching. Your options are:

People
Find entries within the directory that describe a person.
Groups
Find entries within the directory that describe a group. Groups are comprised of a collection of one or more directory entries. For example, groups may be defined at your site that include the System Administrators, or the Technical Writers, or all the people interested in fishing. Note that a group does not always have to identify a collection of people. For example, a group could be defined that identifies all the color printers at your site. Groups can also contain other groups.
Organizations
Find entries within the directory that describe an organization. An organization is usually an entry for a single, very large organization such as a corporation or a university.
Note that an organization differs from a group in that a group is typically an arbitrary collection of people or objects that is subject to change as entities are added to or removed from the directory. Organizations, however, represent a major, relatively static, subdivision or branching of the directory. As such, organizations tend not to be as heavily impacted by additions and subtractions of entities within the directory.
Org_Units
Find entries within the directory that describe an organizational unit. Organizational units usually identify major subdivisions within a larger organization. In contrast to entries from a single, very large organization such as a corporation or university, organizational units describe smaller organizations such as accounting, marketing, the humanities, or the sciences.
Anything
Find any type of entry within the directory that matches the search criteria. You should use Anything if you are unsure of how the directory manager represented an entry within the directory. Anything is also useful if the type of entry for which you are searching is not a person, group, or organization.

Searching for names

If the string you specify on the search:

then Smart Search attempts to find names that match the string. When Smart Search attempts to find a name, it searches through common names (that is, full names) as well as last names.

Smart Search performs each of these types of searches in the following order until at least one value is returned, or until it has performed its last available search:

  1. An exact match for the specified name is performed for the common name and the surname (last name) attributes. That is, Smart Search attempts to find a full name or a last name that matches the specified string exactly. The searches are not case-sensitive (in other words, you do not need to exactly match the way a person's name is capitalized). Also, in the Directory Server, a common name can be the person's full name, and/or the person's first name.

  2. A substring and a "sounds like" search are performed for the common name and surname attributes. The substring search looks for any names containing the specified string. The "sounds like" search looks for any names that sound like the specified string. Both of these searches are run simultaneously, so you may see results that match both criteria. For example, specifying the string:
        son
    
    could return results such as:

        Gary Stevenson
        Mary Sun
        Alison Barker
    
In either case, the general searching algorithm is used when the searches are performed.

Searching for names with initials

If you specify a value that includes the following items in the following order:

then Smart Search will execute the search as if you requested a first initial followed by a last name. For example, specifying the string:

    S. Anderson
could return results such as:

    Sally Anderson
    Steve Anderson
    Sue Anderson
Similarly, if you specify a value that has the following items in the following order:

then Smart Search will execute the search as if you requested a first name followed by a last initial. For example, specifying the string:

    Mark .P
could return entries such as:

    Mark Payne
    Mark Peck
    Mark Polk
Note
Smart Search only looks for exact matches when you use initials. That is, it returns entries with names that use the exact same initial and name as you specify on the search. Approximate (or "sounds-like") and substring searches are not performed.

Specifying search filters

Rather than allowing Smart Search to try to find the correct type of search to use, you can explicitly specify an LDAP search filter. Smart Search assumes that any string containing an equal sign (=) is an LDAP search filter. For example,

    cn=*eve*
is an LDAP search filter that performs a substring search for any common name containing the string eve.

Searching for phone numbers

Smart Search automatically searches for a phone number if the value you enter consists only of numerical digits. A single hyphen (-) is also allowed so long as at least one digit precedes it.

This type of search is actually an "ends with" search. That is, the Directory Server searches for any phone numbers that end with the specified value. For example, if you enter a value such as:

    123
the Directory Server will search for all phone numbers that end with 123.

Searching for e-mail addresses

Smart Search automatically searches for matching e-mail addresses if you provide a value that contains an at (@) symbol. Smart Search uses several search methods in the following order:

  1. An exact search is performed. Smart Search attempts to find e-mail addresses that exactly match the address you have entered. For example, if you supply a search value such as:
        son@a
    
    it will first search for an entry with an e-mail address exactly equal to

        son@a
    
  2. A "starts with" search is performed if no results are returned from the exact search. Smart Search attempts to find e-mail addresses that start with the words you have entered. For example, if you supply a search value such as:
        son@a
    
    an entry such as:

        son@aardvark.org
    
    will be returned, if the entry is in the directory.

Advanced Search

With Advanced Search, you can search for entries that have specific values for certain attributes. For example, Advanced Search allows you to look for a person whose e-mail address is a specified value. Advanced Search performs an exact search, finding the entries that exactly match the words you enter.

Advanced Search also allows you to look up entries who do not include a specified attribute value. For example, you can find all the people whose last name is not "Smith" (note that such a search is likely to return a large number of results, so you may want to avoid these kinds of searches).

Advanced Search options

There are four fields in the Advanced Search form that you use to construct your search. These four fields form together to represent a sentence describing the entry or entries to be found. In general, the sentence is constructed as follows:

Find: [a type of entry] where the: [attribute] [type of search] [search string]

These sentences are very easy to construct because the options for the first three of these fields is provided through pull-down menus. The last field contains the actual search string, which is a value that you type into the form. For example, you can construct a search to:

Find: [People] where the: [Last Name] [is] [Bowker]

Or you can construct a search to:

Find: [People] where the: [Full Name] [sounds like] [tree]

The following section defines each of these fields and the default options available to you in each field. Additional examples are listed at the end of this section.

The Find: field

The Find: field defines the types of entries for which you are searching. Your options are:

People
Find entries within the directory that describe a person.
Groups
Find entries within the directory that describe a group. Groups are comprised of a collection of one or more directory entries. For example, groups may be defined at your site that include the System Administrators, or the Technical Writers, or all the people interested in fishing. Note that a group does not always have to identify a collection of people. For example, a group could be defined that identifies all the color printers at your site.
Organizations
Find entries within the directory that describe an organization. An organization is usually an entry for a single, very large organization such as a corporation or a university.
Note that an organization differs from a group in that a group is typically an arbitrary collection of people or objects that is subject to change as entities are added to or removed from the directory. Organizations, however, represent a major, relatively static, subdivision or branching of the directory. As such, organizations tend not to be as heavily impacted by additions and subtractions of entities within the directory.
Org_Units
Find entries within the directory that describe an organizational unit. Organizational units usually identify major subdivisions within a larger organization. Organizational units describe smaller organizations such as accounting, marketing, the humanities, or the sciences.
Anything
Find any type of entry within the directory that matches the search criteria. You should use Anything if you are unsure of how the directory administrator represented an entry within the directory. Anything is also useful if the type of entry for which you are searching is not a person, group, organizational unit, or organization.

The where the: field

The where the: field defines the actual entry attribute for which you are searching. For example, where the: allows you to select options such as Name, Phone Number, or Description.

The actual options available to you in the where the: field is determined by what you selected in the Find: field.

Find: People
where the: Searches for a person with the matching:
full name full name
last name last name, or surname
phone number phone number
e-mail address e-mail address
user ID user ID
title title, such as Product Manager or President

Find: Groups
where the: Searches for a group with the matching:
name name
description description

The description is usually a free-form sentence of some kind, so you probably will not want to do an exact search in this case. Instead, try a substring search such as "contains", "starts with", or "ends with".

owner owner

This is a distinguished name for the person responsible for maintaining the group list.

Find: Organizations
where the: Searches for an organization with the matching:
name name
location location

This is usually a geographic location such as a city, township, county, or state. Typically location does not indicate the country in which the organization resides.

phone number phone number

This is usually the main number at which the organization can be reached.

description description

The description is usually a free-form sentence of some kind, so you probably will not want to do an exact search in this case. Instead, try a substring search such as "contains", "starts with", or "ends with".

Find: Anything
where the: Searches for anything matching:
name an entry's name

The common name attribute is searched when you choose "Name".

description an entry's description

The description is usually a free-form sentence of some kind, so you probably will not want to do an exact search in this case. Instead, try a substring search such as "contains", "starts with", or "ends with".

The type of: search field

This field describes the type of search to be performed. In general, this field indicates if the search is to be an equality search, substring search, or approximate ("sounds like") search.

The following defines each of the available keywords and the type of search that they represent. Note that not all of these keywords are available for every search; the actual keywords you can use are dependent upon the values you select for the Find: and where the: fields.

is
Causes an exact match to be found. That is, this option specifies an equality search. Use this option when you know the exact value of an entry's attribute. For example, if you know the exact spelling of a person's last name, use this option.
is not
Returns all the entries whose attribute value does not exactly match the search string. That is, if you want to find all the people in the directory whose last name is not "Smith", use this option. Be aware, however, that use of this option can cause an extremely large number of entries to be returned to you.
sounds like
Causes an approximate, or phonetic, search to be performed. Use this option if you know an attribute's value, but you are unsure of the spelling. For example, if you are not sure if a person's last name is spelled "Sarret", "Sarette", or "Sarett", use this option.
starts with
Causes a substring search to be performed. Attributes with values starting with the specified search string are returned. For example, if you know a person's first name is "Steve", but you do not know the last name, use this option on a full name search.
ends with
Causes a substring search to be performed. Attributes with values ending with the specified search string are returned. For example, if you know the last four digits of a person's telephone number are "9876", use this option to locate the person's entry.
contains
Causes a substring search to be performed. Attributes with values containing the specified search string are returned. For example, if you know an organization's description probably contains the word "support", use this option with the search string "support" to find the organization's entry.

Examples

The following examples show a few possible uses of the Advanced Search form. The vertical bars (|) delimit the various fields in the form.

To find all the people whose first name is Darlene:

    Find: People | where the: full name | starts with | Darlene
To find all the people whose last name is Sweeny:

    Find: People | where the: last name | is | Sweeny
To find all the people who are Vice Presidents:

    Find: People | where the: title | contains | Vice President
To find the organization named Accounting:

    Find: Organization | where the: Name | is | Accounting
To find the groups interested in Scuba Diving:

    Find: Groups | where the: description | contains | scuba
To find any entry whose name contains the word "printer":

    Find: Anything | where the: Name | contains | printer

Search Results

As a result of any search that you run, you can get no matches, a single match, or multiple matches.

No Matches
A search result that returns no matches can mean one of two things. The first is that, simply, no entries exist in the directory that match your search criteria. If you believe that this is the problem, try another search using similar but different parameters to see if you can get any other results.
Another cause of a no match situation is if you are required to authenticate before performing the search. Authentication requirements are determined by the directory administrator. Your directory administrator can set the access control on the directory in such a way that you are required to authenticate before you can search the tree. This access control can be set for the entire directory tree or for just a part of the tree. If you are required to authenticate before you can search the directory tree, and you do not authenticate before running the search, the Directory Server will simply act as if no matching entries were found in the directory. Contact your directory administrator to find out if you must authenticate to the Directory Server before running a search.
Finally, you can get no matching results if you have authenticated properly, but the access control for the tree explicitly disallows you from viewing the entry or entries.
Refer to Chapter 6, "Authentication" for more information on authentication.
A single match
If one and only one match can be found in response to an "is" search, you are shown that entry's information immediately. If the single result was found using any other search method, it will be displayed in a table and you must click on the entry to see the entry's detailed information. Note that this form contains an edit entry button. The directory administrator most likely has set up the directory such that you must have special authority to edit an entry. You will be required to authenticate before you can edit the entry. Refer to:
Multiple matches
If multiple matches are found in response to your search, you will see a table that presents each of the matching entries and certain relevant information for each entry, such as the entry's phone number and e-mail address. The actual information displayed is determined by the type of entry for which you are searching. To view more information on a specific entry, click on the entry's name in the first column of the table.
Other problems
You may see odd results if you are searching for numerical values. This is because the Directory Server stores all values as strings, regardless of whether they are actually numerical values (such as telephone or room numbers). Consequently, be careful when you search for numerical values to include all spaces and leading zeros, if any.
Also note that the Directory Server interface strips all leading and trailing blank spaces from your search criteria. While it is unlikely that directory entries actually have leading and trailing blank spaces in their values, the possibility still exists. Because of this, exact matches against values that have leading and trailing blank spaces will fail. If you encounter this problem, you might want to use a substring search (a "contains" search) instead of an exact search.