The contents of mail servers are generally volatile; specifically, the message number is reset as messages are added and deleted. To avoid mismatches between the unique message number identifiers on the server and in the Verity collection, you must re-index the collection before processing a search.
As with the other query types, you must provide a unique value for the key
attribute and enter the data fields to index in the body
attribute.
The following example updates the pop_query collection with the current mail for user1, and searches and returns the message number and subject line for all messages that contain the word action:
<!--- Run POP query. ---> <cfpop action="getall" name="p_messages" server="mail.company.com" userName="user1" password="user1"> <!--- Output POP query record set. ---> <cfoutput query="p_messages"> #messagenumber# <br> #from# <br> #to# <br> #subject# <br> #body# <br> <hr> </cfoutput> <!--- Index record set. ---> <cfindex action="refresh" collection="pop_query" key="messagenumber" type="custom" title="subject" query="p_messages" body="body"> <!--- Search messages for the word "action". ---> <cfsearch collection="pop_query" name="s_messages" criteria="action" maxrows = "100"> <!--- Output search record set. ---> <cfoutput query="s_messages"> #key#, #title# <br> </cfoutput>