To be reallt cool , create a cfc, that allows you to n amount of collections

[psuedocode time ]

<cfcomponent>
        <cfset collections = ArrayNew(1) />

        <cffunction name="addCollection">
                <cfargument name="Collection" >
                add collection to collections Array
        </cffunction>

        <cffunction name="query">
                <cfargument  name="criteria " />
                <cfloop from=1 ...

                        <cfsearch
                              name = "#collections[i]#_results"
                              collection = "collections[i]"
                        />




                </cfloop>

                <cfquery ..name="fullresults">
                        <!--- merge collections results --->
                        <cfloop over collections  ...
                                SELECT  *, CollectionName AS 
'#collections[i]#_results' FROM
#collections[i]#_results
                                UNION
                        </cfloop>
                        order by score
                </cfquery>

                <cfreturn fullresults/>
        </cffunction>


</cfcomponent>

x = my.cfc
x.addcollection("whatever1")
x.addcollection("whatever2")
rs = x.query("<wildcard>`film{ing,ed}`")

WG




-----Original Message-----
From: Jeff [mailto:[EMAIL PROTECTED]
Sent: 22 August 2003 15:40
To: CF-Talk
Subject: Re: Arrrgh, this is driving me crazy, and I know it's so simple
to do...


on 8/22/03 10:32 AM, webguy at [EMAIL PROTECTED] wrote:
> why not do this
>
> 1. Query a verity collection, return the results as "key, title, body"
(also
> get back a score)
>
> 2. Query a 2nd verity collection, return the results as "key, title, body"
> (also get back a score)
>
>
> <cfquery >
> SELECT * FROM Query1
> UNION
> SELECT * FROM Query2
> order  scores desc
> </cfquery>

Okay, I haven't even tried it yet, but I damn near fainted when I saw it...I
KNEW it would be something easy like this. I KNEW it!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to