Updating Collections

Unless your Verity collection is indexed from data that never changes, at some point in time you will need to make updates to it. Whether it is to add a new record to the collection or delete one, updating a Verity collection is an important part of keeping your searchable content current.

Adding New Records to a Collection

New records can easily be added to an existing Verity collection using one of two methods. The first method consists of purging the Verity collection of all records and repopulating it. This is done by setting the ACTION attribute of the CFINDEX tag to Refresh. This method ensures that your Verity collections always contain the most up-to-date information. The disadvantage to this method is that it can be relatively time-consuming for larger collections because it has to completely reindex a collection just to add a single record. The following syntax shows how to use the CFINDEX tag to purge and reindex a collection:

<!--- Purge and repopulate a collection using the refresh property of the 
      ACTION attribute --->
<CFQUERY NAME="IndexNews" DATASOURCE="ProgrammingCF">
    SELECT ArticleID, Title, Article FROM News 

  <CFINDEX COLLECTION="News" ACTION="Refresh" TYPE="Custom"  
           BODY="Title,Article" KEY="ArticleID" TITLE="Title" QUERY="IndexNews">

The second method is to add the new record by appending it to the end of the collection. This is simple to do using the CFINDEX ...

Get Programming ColdFusion now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.