Searching’an Indexed Query Result'” ColdFusion Help

The principles behind searching a query set are the same as the seapplied when searching an index of documents. Keep in mind the following differences about the data stored in the columns of the search result:
• The URL field is always empty. The data in the query result has nothing to do with URLs. If you want to create a clickable URL so that userscan view the complete record found in a search, you need, to build a URL from the data stored in the other. fields of the search results.
• The KEYcolumn contains the contents of the column name specified in the KEY attribute of the CFINDEX tag when creating the index. Generally, this is used for the primary key of the table being ‘indexed, ana theprimary key of eachrecord  returned by the search is contained in this column.
• The TITLE column contains the contents of the column name specified in the TITLE attribute of the CFINDEX tag when creating the index.

‘Building’a’ Complete Search ‘System

To apply.all this, the next step is to build a complete ‘SearChrs~tem. This system will search the collection named collection naine. For the sake of Simplicity, this collection ,is an index of documents.

The following ‘template file performs two tasks: It presents asearch form and, if it receives search criteria from a form, it .also executes a search and displays the results:

The logic of this template is fairly simple:
• A search form is always displayed. The search form’s ACTION attribute points back to the same template. In other words, each time Submit is clicked, the data in the form is submitted back to the same template:
• The CF1F tag uses the Paramet.erfx ists function to see whether Form. CRITERIA exists. If this is the first time the template is being accessed, then the variable won’t exist and no search is executed or results displayed,. If, on the other hand, the form is submitted, then Form. CRITERIA will exist when the template is accessed and a search will be :executed and the result displayed.

Where Do We Go from Here?

The next chapter addresses a fundamental concern in many interactive applications: security. In applications that interactively access data, you often need to ensure that.ortly authorized users have access to the applications and that they can perform only the tasks for which they have permission. In the next chapter, you will consider issues of application security and how they are addressed in ColdFusion, including issues related to user security, server sandbox security, and administrator security.

Posted on November 16, 2015 in Implementing a Search Engine

Share the Story

Back to Top
Share This