crazydiamond
11-13-2003, 01:22 AM
Im slowly building a ColdFusion Verity Search feature and it is not going very well.
I have made it so the user can enter in search criteria and the site searches for all the database records matching that criteria - however when it comes to displaying the results only the last database record matching the search criteria is displayed. I want ALL of the database records meeting the search criteria to be displayed.
For example - i have a field by the name of "enteredBy" and it has a number of entries containing "Bob" - theres about 6 or 7 of them. The search only picks up and displays the last entry that Bob made in the database and not all of the entries that he made.
My code is as follows:
searchprocess.cfm:
<cfsearch collection="advertisements" name="findItems" criteria="#keywords#" type="simple">
<cfset searchList = finditems.key>
<cfquery name="UseVerityResults" datasource="advertisements">
Select * from ads where adnumber = #searchList#
</cfquery>
<P>
<cfoutput query="UseVerityResults">
#sellername#, #adverttitle#
</cfoutput>
----------------
The following file indexes all of the ads and indexes them in a verity collection called 'advertisements':
<CFQUERY NAME="GetAdvertisements" datasource="advertisements">
SELECT *
FROM ads
</CFQUERY>
<!--- Output the result set --->
<CFOUTPUT QUERY="GetAdvertisements">
#adnumber#,#category#,#region#,#expirydate#,#dateentered#,#emailaddress#,#advertisementcontents#,#se llername#,#adverttitle#
</CFOUTPUT>
<!--- Index the result set --->
<CFINDEX COLLECTION="Advertisements"
ACTION="UPDATE"
BODY="adnumber,sellername,adverttitle,emailaddress,dateentered,expirydate,advertisementcontents,category,r egion"
KEY="adnumber"
TITLE="Adverttitle"
QUERY="GetAdvertisements">
----------------
Does anyone have any ideas?
Cheers
I have made it so the user can enter in search criteria and the site searches for all the database records matching that criteria - however when it comes to displaying the results only the last database record matching the search criteria is displayed. I want ALL of the database records meeting the search criteria to be displayed.
For example - i have a field by the name of "enteredBy" and it has a number of entries containing "Bob" - theres about 6 or 7 of them. The search only picks up and displays the last entry that Bob made in the database and not all of the entries that he made.
My code is as follows:
searchprocess.cfm:
<cfsearch collection="advertisements" name="findItems" criteria="#keywords#" type="simple">
<cfset searchList = finditems.key>
<cfquery name="UseVerityResults" datasource="advertisements">
Select * from ads where adnumber = #searchList#
</cfquery>
<P>
<cfoutput query="UseVerityResults">
#sellername#, #adverttitle#
</cfoutput>
----------------
The following file indexes all of the ads and indexes them in a verity collection called 'advertisements':
<CFQUERY NAME="GetAdvertisements" datasource="advertisements">
SELECT *
FROM ads
</CFQUERY>
<!--- Output the result set --->
<CFOUTPUT QUERY="GetAdvertisements">
#adnumber#,#category#,#region#,#expirydate#,#dateentered#,#emailaddress#,#advertisementcontents#,#se llername#,#adverttitle#
</CFOUTPUT>
<!--- Index the result set --->
<CFINDEX COLLECTION="Advertisements"
ACTION="UPDATE"
BODY="adnumber,sellername,adverttitle,emailaddress,dateentered,expirydate,advertisementcontents,category,r egion"
KEY="adnumber"
TITLE="Adverttitle"
QUERY="GetAdvertisements">
----------------
Does anyone have any ideas?
Cheers



