I have a search working, but I still have one problem. If I search for a term that is not there, Verity appears to return a value of NULL for SearchResults.RecordsSeached. I have tested to make sure this variable is defined(which it is), but when I try to output SearchResults.RecordsSearched, it returns blank. If I search for something that IS there, it returns the appropriate number of records searched. Here is the code:
Does Verity return NULL for the number of records searched if no results are found? Thanks!
Code:
<!--- Perform the search --->
<CFSEARCH COLLECTION="Messages"
NAME="SearchResults"
TYPE="SIMPLE"
CRITERIA="#Form.SearchTerm#">
<CFIF IsDefined("SearchResults.RecordsSearched")>
<CFOUTPUT>Yes</CFOUTPUT>
<CFELSE>
<CFOUTPUT>No</CFOUTPUT>
</CFIF>
<BR><BR>
<!--- Output number of results --->
<CFOUTPUT>The number of records searched = #SearchResults.RecordsSearched#</CFOUTPUT><BR><BR>
<CFIF IsDefined("SearchResults.RecordsSearched")>
<CFOUTPUT>The number of records searched is #SearchResults.RecordsSearched#</CFOUTPUT><BR><BR>
<CFELSE>
<CFOUTPUT>No records were searched.</CFOUTPUT><BR><BR>
</CFIF>
<BR><BR>
<!--- Output the search results --->
<CFOUTPUT QUERY="SearchResults">
#Title# #Score#<BR><BR>
</CFOUTPUT>
Does Verity return NULL for the number of records searched if no results are found? Thanks!