Skip to main content
August 20, 2009
Question

<cfsearch> doubt

  • August 20, 2009
  • 1 reply
  • 825 views

Hello,

I'm having some trouble with the <cfsearch> tag. I managed to index my database query to my collection, and I can search the data. However, I want to get the field names for the values returned from the search.  Here's an example:

I have a table called media that has the following columns: name, id, postdate, url, type, user, extension

After search using cfsearch, how do I get the values of name, id, postdate, url, type, user and extension. Since there are more than 4 fields, I cannot use custom1-custom4 in my cfindex. What can I do to retrieve this data?

Thanks.

    This topic has been closed for replies.

    1 reply

    Inspiring
    August 22, 2009

    you need to create advanced search form, you can do that  without cfsearch. Could you please provide your code?


    Hold on! Do you want to search thru all fields in a table or you want to display them? If you only want to display them search for name(of whatever) and

    them use something like this to display your results:

    <cfquery name="test" datasource"yourdatasource">

    SELECT *
    FROM  yourtable

    WHERE NAME = "#URL.NAME#"

    ORDER BY NAME DESC
    </cfquery>

    <cfoutput>#test.field1#</cfoutput>

    <cfoutput>#test.field2#</cfoutput>

    <cfoutput>#test.field3#</cfoutput>

    <cfoutput>#test.field4#</cfoutput>

    <cfoutput>#test.field5#</cfoutput>

    This is simple code, if you need something advanced please let me know.

    August 24, 2009

    Yes, I want to display the results, but I cannot use a cfquery because it'll be really slow, because of the size of my database. That's why I'm trying to display the results with cfsearch.

    Inspiring
    August 24, 2009

    how big is your database? did you update collection with cfquery or... OK please provide me your code i will figure out.