This is my first foray into using cfsearch. I have the below code working on my dev server with ColdFusion 10, and a collection I previously created.
The only way I can get this to return consistent results is to place a "sleep" between the cfindex and cfsearch. Otherwise the search returns no results 90% of the time and on occasion some or all results. My query only has 3 records and the collection has been optimized.
It is important to refresh the collection as this is a business directory that will be changing frequently.
<form action="search.cfm" method="get">
<input type="text" name="searchFor">
<input type="submit" value="Search">
</form>
<cfquery name="qryData" datasource="#session.DataSource#">
SELECT biz_id, biz_name, biz_city, biz_state, biz_county
FROM biz
WHERE user_level > 0 AND user_level < 99
</cfquery>
<cfindex collection="mySearch" action="refresh" body="biz_name,biz_city,biz_state,biz_county" key="biz_id" query="qryData">
<cfset sleep(100)>
<cfsearch name="search" collection="mySearch" criteria="#url.searchFor#" maxrows="100">
<cfdump var="#search#">