[thelist] cfsearch of a path returns no results

Chris Hayes chris at londonweb.net
Tue Apr 13 12:58:34 CDT 2004


OK.. I haven't used CF for file indexing since version 3 but I remember it's
quirky about 2 things, paths and extensions.

I imagine you're
    key="#GetDirectoryFromPath(GetBaseTemplatePath())#"
is pointing in the right place.. probably the first thing you checked .

But as you're indexing htm(L) extensions, and these are default you don't
need to specify the extension attribute in your cfindex tag.  If you do
specify it I think it goes like this:

    extensions=".txt, .pdf"

If you don't specify and your target folder, or recursed folders, contain
CFML files, these will be indexed and you may expose some code, eg somebody
could search for CFQUERY and get back your query and DSN etc.  So you're
best off specifying your html extensions only.  I know it's a static site
but who knows.. in the future...

You might also want to keep your collection folder outside of the web root,
it's good practice.

HTH

Chris


----- Original Message ----- 
From: "Sarah Sweeney" <mr.sanders at designshift.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, April 13, 2004 6:02 PM
Subject: Re: [thelist] cfsearch of a path returns no results


> > Can you post the code you are using for  (cfcollection,) cfindex and
> > cfsearch.
>
> Sure, here's the code:
>
> <cfcollection
>    action="create"
>    collection="cfsearchTest"
>    path="#GetDirectoryFromPath(ExpandPath(''))#verity/collections/">
>
> <cfindex
>    collection="cfsearchTest"
>    action="refresh"
>    type="path"
>    recurse="yes"
>    key="#GetDirectoryFromPath(GetBaseTemplatePath())#"
>    extensions=".*">
>
> <cfsearch
>    name="searchResults"
>    collection="cfsearchTest"
>    criteria="#form.Criteria#">
>
> Results: <cfoutput>#searchResults.RecordCount#</cfoutput>
>
> <cfdump var="#searchResults#">
>
> Sarah
>
> -- 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !



More information about the thelist mailing list