User Guide

Table Of Contents
578 Chapter 24: Building a Search Interface
To search and display the directory path:
1.
Create a ColdFusion page that contains the following content:
<cfsearch
collection="#Form.collname#"
name="getEmps"
criteria="#Form.Criteria#"
maxrows = "100">
<!--- Output the directory path contained in the record set. --->
<cfoutput>
Your search returned #getEmps.RecordCount# file(s).
</cfoutput>
<cfoutput query="getEmps">
<p><table>
<tr><td>Title: </td><td>#Title#</td></tr>
<tr><td>Score: </td><td>#Score#</td></tr>
<tr><td>Key: </td><td>#Key#</td></tr>
<tr><td>Summary: </td><td>#Summary#</td></tr>
<tr><td>Custom 1:</td><td>#Custom1#</td></tr>
<tr><td>Column list: </td><td>#ColumnList#</td></tr>
</table></p>
</cfoutput>
2.
Save the file as displaydir.cfm.
Indexing query results obtained from an LDAP directory
The widespread use of the Lightweight Directory Access Protocol (LDAP) to build searchable
directory structures, internally and across the web, gives you opportunities to add value to the
sites that you create. You can index contact information or other data from an LDAP-accessible
server and let users search it.
When creating an index from an LDAP query, remember the following considerations:
Because LDAP structures vary greatly, you must know the server’s directory schema and the
exact name of every LDAP attribute that you intend to use in a query.
The records on an LDAP server can be subject to frequent change.
In the following example, the search criterion is records with a telephone number in the 617 area
code. Generally, LDAP servers use the Distinguished Name (
dn) attribute as the unique identifier
for each record so that attribute is used as the
key value for the index.
<!--- Run the LDAP query. --->
<cfldap name="OrgList"
server="myserver"
action="query"
attributes="o, telephonenumber, dn, mail"
scope="onelevel"
filter="(|(O=a*) (O=b*))"
sort="o"
start="c=US">
<!--- Output query record set. --->