Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another Verity question

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
0
0
US
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:

Code:
<!--- Perform the search --->
<CFSEARCH COLLECTION=&quot;Messages&quot;
          NAME=&quot;SearchResults&quot;
          TYPE=&quot;SIMPLE&quot;
          CRITERIA=&quot;#Form.SearchTerm#&quot;>
		  
<CFIF IsDefined(&quot;SearchResults.RecordsSearched&quot;)>
	<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(&quot;SearchResults.RecordsSearched&quot;)>
	<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=&quot;SearchResults&quot;>
	#Title#  #Score#<BR><BR>
</CFOUTPUT>

Does Verity return NULL for the number of records searched if no results are found? Thanks!

 
Try using SearchResults.RecordCount If there is no results it should return 0 not null.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top