Forum Moderators: phranque

Message Too Old, No Replies

ColdFusion Search

         

kevinj

2:31 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



I have set up a CF Verity Collection/Index search on a few of the sites I've developed but now have a customer who wants a search tool for the ASP/SQL driven shopping cart we're developing for them. Does anyone know if a CF search can be adapted to search ASP pages that pull product info from a SQL database?
Also, are there any other simple/cheap/free tools that would accomplish this type of search that I should investigate?

Thanks,
Kevin

Stretch

2:56 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



Don't know about searching the asp pages but you can use verity to index a SQL DB. Use a query to extract the DB info and then create the collection from the returned data:

<cfquery name="myQuery" dataSource="myDB">
SELECT *
FROM myTable
</cfquery>

<cfcollection action="CREATE" collection="#myQuery.myTable#" path="path/to/where/collection/is/created">

Assuming your DB includes the URL to the ASP pages you can link to them from the search results. Any help?

kevinj

3:10 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



That might be the way to do it. I think I could include the URL in the db. Is there a way to tell CF to look at certain db fields only? Thanks for the good idea Stretch.

Kevin

Stretch

3:33 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



I would guess just adjust the query. I.e:

SELECT X,Y,Z
WHERE A = B

As oppose to:

SELECT *

BTW, if you have a DB field called URL you can call this when you reference the search results (cfsearchresults.URL) without using one of the custom fields.

I hope that makes sense...

Stretch

3:39 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



Of course the structure you use in your cfindex determines which fields are used for the actual search results and which ones are additional info (URL, tracking ID etc, etc)

<CFINDEX collection="#whatever#" action="UPDATE" query="Content" title="headline*" type="CUSTOM" custom1="headline*" custom2="HTMLfile*" body="body*,headline*" key="contentid*">

All marked with * are names of DB fields but only those in the body="" are used for the index. Still not sure I'm making sense.

kevinj

5:59 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



Yes. That makes sense. Thanks for the sample code. That will save me some time when we start to program the search. Are you aware of any other search tools that are good for searching databases?

Kevin

Stretch

6:49 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



Can't say that I am. I've only used CF for DB searches. It's not the most accurate or flexible search tool but the Thesaurus, Soundex and Typo functions can be useful and it's very quick and easy to setup.