Submitting Queries to the Verity Search Server


After you have your collection in place and your site indexed, you should create a search interface that enables your visitors to submit their queries to the Verity server for comparison against the collection. A simple form such as the one in Figure 20.10 enables the visitor to enter a search term and submit it to a page that displays the results.

Figure 20.10. A simple search form that submits a query to Verity.


The results page is where the real search magic takes place. For instance, suppose that the text field in the search form was named tfSearchTerm. The results page needs a snippet of code like the following to begin the search:

<CFSEARCH NAME="searchMyCollection" COLLECTION="myCollection" CRITERIA="#FORM.tfSearchTerm#">


This tag compares the content of the tfSearchTerm text field with the data stored in the myCollection Verity collection.

Note

The value of the COLLECTION attribute must match the name of the collection that you created in the ColdFusion Administrator.


To output the search results on the page, add the following code:

<CFOUTPUT QUERY="searchMyCollection">     <a href="#URL#">#Title#</a> </CFOUTPUT>


This code outputs the results of the searchMyCollection search and displays the Title as a clickable hyperlink. The #URL# and #Title# variables are built-in variables that are returned by the <cfsearch> tag. Some additional variables that you can use include the following:

  • scoreDisplays the relevancy score of the result based on the frequency with which the search term occurs in the page.

  • summaryDisplays a brief summary of the document.

  • recordCountDisplays the number of results returned by the query.

  • recordsSearchedDisplays the number of records searched within the collection.

  • authorNew in ColdFusion MX 7, this variable displays the name of the document author.

  • categoryNew in ColdFusion MX 7, this variable displays the category of the document if the collection allows for categorization.

  • sizeNew in ColdFusion MX 7, this variable displays the size of the document in bytes.

  • typeNew in ColdFusion MX 7, this variable displays the MIME type of the document.

Using these basic concepts, you should understand how the Verity Search Server can assist you in providing search capabilities to your site visitors. When coupled with SQL queries against the database, this powerful search engine application can assist you in ensuring that your visitors are able to find the information they are looking for.



Special Edition Using Macromedia Studio 8
Special Edition Using Macromedia Studio 8
ISBN: 0789733854
EAN: 2147483647
Year: 2003
Pages: 337

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net