Hi, I can't seem to get the following query of an index server collection to search wildcards? It will only return exact results. I am using the code available at http://www.cfcomet.com/index_server/ on win 2k cf server 5. Collection size 170mb and contains 60,000 docs.
I have tried using, WHERE Contents LIKE '#wordsearch#' in my where clause but the page just churns away and eventually the page stops processing and is a blank white page. Here is the code... <CFSCRIPT> /* Set variables for establishing the connection (change to your values) */ Catalog = "system"; // Catalog name of the index UserName = ""; // Username (if applicable) Password = ""; // Password (if applicable) /* This value should be passed via form or URL. We hardcode it for easy reading */ WordSearch = "html"; /* SQL statement */ SQL = "SELECT Characterization, DocTitle, DocKeywords, Rank, VPath FROM scope() "; SQL = SQL & "WHERE freetext(' #wordsearch# ') > 0 "; SQL = SQL & "ORDER BY Rank DESC"; /* Create an instance of the ADO Connection COM object */ MyConnection = CreateObject("COM", "ADODB.Connection"); /* Set connection variables; the provider will stay the same */ MyConnection.Open("provider=msidxs;Data Source=#Catalog#", "#UserName#", "#Password#", -1); /*Max Records */ MyConnection.MaxRecords = 10; /* Execute the SQL against the ADO connection */ MyRecordset = MyConnection.Execute(SQL, 0, 8); /* Return a collection of the fields returned by the SQL */ MyFields = MyRecordset.Fields; /* We need to manually see how many records exist */ /* The RecordCount property of 'MyRecordset' won't do, since it returns -1 */ RecordCount = 0; while(NOT MyRecordset.EOF){ RecordCount = RecordCount + 1; // Increment the count MyRecordset.MoveNext(); // Proceed to the next record } </CFSCRIPT> <CFIF NOT RecordCount> <P>No results matched your search. <CFABORT> </CFIF> <CFSCRIPT> /* Move to the first record */ MyRecordset.MoveFirst(); /* Make the query to make data easier to manage and control */ IndexServ = QueryNew("Characterization, DocTitle, DocKeywords, Rank, VPath"); /* Add number of records to the query */ QueryAddRow(IndexServ, RecordCount); </CFSCRIPT> <CFLOOP INDEX="i" from="1" to="#RecordCount#"> <CFLOOP COLLECTION="#MyFields#" ITEM="this"> <!--- Add a record to the query ---> <CFSET QuerySetCell(IndexServ, this.Name, this.Value, i)> </CFLOOP> <!--- Move to the next record from the COM object results ---> <CFSET MyRecordset.MoveNext()> </cfloop> <!--- Close the connection to com object ---> <CFSET MyConnection.Close()> <TABLE CELLPADDING="0" CELLSPACING="2" BORDER="0" WIDTH="100%"> <TR> <TD COLSPAN="3"> <CFOUTPUT>Search for "<b>#wordsearch#</b>" returned <B>#RecordCount#</B> matches</CFOUTPUT> </TD> </TR> <TR> <TD> </TD> </TR> <CFOUTPUT QUERY="IndexServ"> <TR> <TD WIDTH="10">#CurrentRow#.)</TD> <TD> </TD> <TD NOWRAP>#NumberFormat(Round(Rank/10))#% <A HREF="#VPath#">#DocTitle#</A></TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD NOWRAP>#VPath#</TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD><B>Summary:</B> #HTMLEditFormat(Characterization)#</TD> </TR> </CFOUTPUT> </TABLE> Thanks!! Carl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm