Solved

Block pages from CFCOLLECTION

Posted on 2004-03-24
12
452 Views
Last Modified: 2013-12-24
I have my site hosted remotely.

I would like to create a CFCOLLECTION, but exclude certain pages (such as Application.cfm, robots.txt, and anything with _vti_cnf in the URL).

How can this be done?

Matthew
0
Comment
Question by:M256
  • 5
  • 3
12 Comments
 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
you don't exclude files in cfcollection you exclude files in cfindex

Description
Populates a Verity search engine collection with an index of documents on a file system or of ColdFusion query result sets.

A collection must exist before it can be populated.

A collection can be indexed in the following ways:

In ColdFusion, with the cfindex tag
In the ColdFusion Administrator, which calls the cfindex tag
Using a native Verity indexing tool, such as Vspider or MKVDK
Category
Extensibility tags

Syntax
<cfindex
    collection = "collection_name"
    action = "action"
    type = "type"
    title = "title"
    key = "ID"
    body = "body"
    custom1 = "custom_value"
    custom2 = "custom_value"
    URLpath = "URL"
    extensions = "file_extensions"
    query = "query_name"
    recurse = "Yes" or "No"
    language = "language">

See also
cfcollection, cfexecute, cfobject, cfreport, cfsearch, cfwddx

History
ColdFusion MX:

The action attribute value optimize is obsolete. It does not work, and might cause an error, in ColdFusion MX.
Changed the external attribute behavior: it is not necessary to specify the external attribute. (ColdFusion automatically detects whether a collection is internal or external.)
Changed Verity operations behavior: ColdFusion supports Verity operations on Acrobat PDF files.
Changed thrown exceptions: this tag can throw the SEARCHENGINE exception.
Changed acceptable collection naming: this tag accepts collection names that include spaces.
Changed query result behavior: the cfindex tag can index the query results from a cfsearch tag.
Attributes
 Attribute Req/Opt Default Description
collection
 Required
 
 Name of a collection that is registered by ColdFusion; for example, "personnel"
Name and absolute path of a collection that is not registered by ColdFusion; for example:
"e:\collections\personnel"
 
action
 Depends on collection attribute value; see Usage section
 
 update: updates a collection and adds key to the index. Do not use the cflock tag with this option.
delete: deletes data in the entities specified by the type attribute
purge: deletes all keys from a collection
refresh: purges all keys from a collection, then updates it.
 
type
 Optional
 custom, if query attribute is specified. file, otherwise.
 file: using the key attribute value of the query result as input, applies action value to filenames or filepaths.
path: using the key attribute value of the query result as input, applies action to filenames or filepaths that pass the extensions filter
custom: If action = "update" or "delete": applies action to custom entities in query results.
 
title
 Optional
 
 Title for collection
Query column name for type and a valid query name
Permits searching collections by title or displaying a separate title from the key
 
key
 Depends on action attribute value; see Usage section
 (empty string)
 Absolute path and filename, if type = "file"
Absolute path, if type = "path"
A query column name (typically, the primary key column name), if type = "custom"
A query column name, if type = any other value
This attribute is required for the actions listed, unless you intend for its value to be an empty string.
 
body
 Required if type = "custom"; see Usage section
 
 ASCII text to index
Query column name(s), if name is specified in query
You can specify columns in a delimited list. For example: "emp_name, dept_name, location"
 
custom1
 Optional
 
 Custom field in which you can store data during an indexing operation. Specify a query column name for type, and a query name.
 
custom2
 Optional
 
 Usage is the same as for custom1.
 
URLpath
 Optional
 
 If type="file" or "path", specifies the URL path. When the collection is searched with cfsearch, this pathname is prefixed to filenames and returned as the url attribute.
 
extensions
 Optional
 HTM, HTML, CFM, CFML, DBM, DBML
 Delimited list of file extensions that ColdFusion uses to index files, if type = "Path".
"*." returns files with no extension.
For example: the following code returns files with a listed extension or no extension: extensions = ".htm, .html, .cfm, .cfml, "*."
 
query
 Required if type = "custom"; see Usage section
 
 Query against which collection is generated
 
recurse
 Optional
 No
 Yes: if type = "path", directories below the path specified in key are included in indexing operation
No
 
language
 Optional
 English
 For options, see cfcollection. Requires the appropriate (European or Asian) Verity Locales language pack.
 


Usage
This tag populates Verity search engine collections with metadata from the following sources:

Documents stored on a file system
ColdFusion query result sets
The following table shows the dependent relationships among this tag's attribute values:

 Specifying this attribute is required, optional or unnecessary (blank): For this action attribute value:
purge  delete  update or refresh  
collection
 Required
 Required
 Required
 
type
 
 Optional
 If type = "file", "path", or "custom": Optional.
 
title
 
 
 If type = "file", "path", or "custom": Optional.
Otherwise: unnecessary.
 
key
   
 Required
 If type = "file", "path", or "custom": Required.
Otherwise: unnecessary.
 
body
 
 
 If type = "custom": Required.
Otherwise: unnecessary.
 
custom1
 
 
 If type = "file", "path", or "custom": Optional.
Otherwise: unnecessary.
 
custom2
 
 
 If type = "file", "path", or "custom": Optional.
Otherwise: unnecessary.
 
URLPath
 
 
 If type = "file" or "path": Optional.
Otherwise: unnecessary.
 
extensions
 
 
 If type = "path": Optional.
Otherwise: unnecessary.
 
query
 
 If type = "file", "path": Optional.
If type = "custom": Required.
 If type = "file","path": Optional.
If type = "custom": Required.
 
recurse
 
 
 If type = "path": Optional.
Otherwise: unnecessary.
 
language
 
 If If type = "file", "path", or "custom": Optional.
 If type = "file", "path", or "custom": Optional.
 


For all action values of this tag except update, use the cflock tag to protect the collection during tag execution.

For information on the file types you can use with the Verity search engine, see Article 22492, ColdFusion Server (versions 4.5 and higher): Supported File Types for Verity, on the Macromedia ColdFusion Support Center, at www.macromedia.com/support/coldfusion/.

Example
<!--- for ACTION=UPDATE ----------------------------------------------->
<!--- for ACTION=UPDATE, #1 (TYPE=FILE) (key is a filename) ---->
<cfindex
        collection="snippets"
        action="update"
        type="file"
        key="c:\inetpub\wwwroot\cfdocs\snippets\abs.cfm"
        urlpath="http://localhost/cfdocs/snippets"
        custom1="custom1"
        custom2="custom2" >

<!--- for ACTION=UPDATE, #2 (TYPE=FILE) (key is a query result set column)
---->
<cfquery         name="bookquery"
        datasource="book">
        select *from book where bookid='file'
</cfquery>
<cfoutput
        query="bookquery">
            --#url#,#description#-- <br>
</cfoutput>
<cfindex
        collection="snippets"
        action="update"
        type="file"
        query="bookquery"
        key="description"
        urlpath="url">

<!--- for ACTION=UPDATE, #3 (TYPE=PATH) (extensions .htm, .html,.cfm,.cfml)
--->
<cfindex         collection="snippets"
        action="update"
        type="path"
        key="c:\inetpub\wwwroot\cfdocs\snippets"
        urlpath="http://localhost/cfdocs/snippets"
        custom1="custom1"
        custom2="custom2"
        recurse="no"
        extensions=".htm, .html, .cfm, .cfml" >

<!--- for ACTION=UPDATE, #4 (TYPE=PATH)
        (extensions are         files with no extension) ---->
<cfindex
        collection="snippets"
        action="update"
        type="path"
        key="c:\inetpub\wwwroot\cfdocs\snippets"
        urlpath="http://localhost/cfdocs/snippets"
        custom1="custom1"
        custom2="custom2"
        recurse="no"
        extensions="*." >

<!--- for ACTION=UPDATE, #5 (TYPE=PATH)
        (extensions are files with any extension) ---->
<cfindex
        collection="snippets"
        action="update"
        type="path"
        key="c:\inetpub\wwwroot\cfdocs\snippets"
        urlpath="http://localhost/cfdocs/snippets"
        custom1="custom1"
        custom2="custom2"
        recurse="no"
        extensions=".*">

<!--- for ACTION=UPDATE, #6 (TYPE=PATH) (where the key
        is a query result set column) ---->
<cfquery         name="bookquery"
        datasource="book">
        select * from book where bookid='path1' or bookid='path2'
</cfquery>
<cfoutput
        query="bookquery">
            --#url#,#description#-- <br>
</cfoutput>
<cfindex
        collection="snippets"
        action="update"
        type="path"
        query="bookquery"
        key="description"
        urlpath="url" >

<!--- for ACTION=UPDATE, #7 (TYPE=CUSTOM) ---->
<cfquery         name="book"
        datasource="book">
        select * from book
</cfquery>
<cfindex
        collection="custom_book"
        action="update"
        type="custom"
        body="description"
        key="bookid"
        query="book">

<!--- for ACTION=REFRESH----------------------------------------------->
<!--- ACTION=REFRESH, #1 (TYPE=FILE) ---->
<cflock         name="verity"
        timeout="60">
<cfindex
        collection="snippets"
        action="Refresh"
        type="file"
        key="c:\inetpub\wwwroot\cfdocs\snippets\abs.cfm"
        urlpath="http://localhost/"
        custom1="custom1"
        custom2="custom2" >
</cflock>

<!--- ACTION=REFRESH, #2 (TYPE=PATH) ---->
<cflock         name="verity"
        timeout="60">
<cfindex
        collection="snippets"
        action="refresh"
        type="path"
        key="c:\inetpub\wwwroot\cfdocs\snippets"
        urlpath="http://localhost/cfdocs/snippets/"
        custom1="custom1"
        custom2="custom2"
        recurse="yes"
        extensions=".htm,.html,.cfm,.cfml" >
</cflock>

<!--- ACTION=REFRESH, #3 (TYPE=CUSTOM) ---->
<cfquery         name="book"
        datasource="book">
        select * from book
</cfquery>

<cfindex
        collection="custom_book"
        action="refresh"
        type="custom"
        body="description"
        key="bookid"
        query="book">

<!--- for ACTION=DELETE----------------------------------------------->

<!--- ACTION=DELETE, #1 (TYPE=FILE) ---->
<cflock         name="verity"
        timeout="60">
<cfindex
        collection="snippets"
        action="delete"
        key="c:\inetpub\wwwroot\cfdocs\snippets\abs.cfm" >
</cflock>

<!--- ACTION=DELETE, #2 (TYPE=FILE) (the key is a query result set column)
---->
<cflock         name="verity"
        timeout="60">
<cfquery         name="book"
        datasource="book">
        select * from book where bookid='file'
</cfquery>
<cfoutput
        query="book">
            --#description#-- <br>
</cfoutput>    
<cfindex
        collection="snippets"
        action="delete"
        type="file"
        query="book"
        key="description" >
</cflock>

<!--- ACTION=DELETE, #3 (TYPE=PATH) ---->
<cflock         name="verity"
        timeout="60">
<cfindex
        collection="snippets"
        action="delete"
        type="path"
        key="c:\inetpub\wwwroot\cfdocs\snippets"
        extensions=".cfm"
        recurse="no">
</cflock>

<!--- ACTION=DELETE, #4 (TYPE=PATH) (key is a query result set column) ---->
<cflock         name="verity"
        timeout="60">
<cfquery
        name="bookquery"
        datasource="book">
            select * from book where bookid='path1'
        </cfquery>
<cfoutput
        query="bookquery">
            --#url#,#description#-- <br>
</cfoutput>
<cfindex
        collection="snippets"
        action="delete"
        type="path"
        query="bookquery"
        key="description" >
</cflock>

<!--- ACTION=DELETE, #5 (TYPE=CUSTOM) ---->
<cflock name="verity"
        timeout="60">
<cfquery         name="book"
        datasource="book">
        select * from book where bookid='bookid1'
</cfquery>
<cfindex
        collection="custom_book"
        action="delete"
        type="custom"
        query="book"
        key="bookid" >
</cflock>

<!--- for ACTION=PURGE----------------------------------------------->
<cflock name="verity"
        timeout="60">
<cfindex
        action="purge"
        collection="snippets">
</cflock>

0
 
LVL 5

Author Comment

by:M256
Comment Utility
CFDevHead,

You said:

> you don't exclude files in cfcollection you exclude files in cfindex

Please tell me how to exclude files with cfindex.

I have read the documentation, and have not seen how.
My code currently:
<cfset path = ExpandPath("../")>
<cfcollection action="create" collection="osbornewood" path="#path#">
<cfindex collection = "osbornewood"
  action = "update"
  type = "path"
  key = "#path#"
  recurse = "No">

Matthew
0
 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
I am sorry I meant to say you can only exclude file type not files.
0
 
LVL 5

Author Comment

by:M256
Comment Utility
OK.

I am going to use this code I wrote to block those pages.

<cfsearch name="search" collection="osbornewood" criteria="#form.criteria#">
<cfoutput query="search">
<cfif ReFind("_vti|Application.cfm|robots.txt", search.url) is false>
   <a href="../#url#"><cfif title neq "">#title#<cfelse>No Title</cfif></a><br> (URL: #url#)<br>
   #ReReplace(SUMMARY,"#rg#"," ","all")# <br>
   Score: <cfif score lte 0>0<cfelse>#numberformat(score*100,"99")#</cfif>% <p>
</cfif>
</cfoutput>

I would prefer to not have them added to the index in the first place to save processing time.  If anybody has any ideas, please let me know.  Otherwise, I will ask for a PAQ and points refunded.

Matthew
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
Verity collection is not meant to index websites is it meant to index documents. such as [.xls,.doc,.pdf,.html,.....]
As for this >>Otherwise, I will ask for a PAQ and points refunded.
I would think that would be wrong to do since I have answered your question.


Thank You!
0
 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
lunchy are you talking about my first post to this question?
0
 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
the source is homesite help file.
0
 
LVL 5

Author Comment

by:M256
Comment Utility
CFDevHead,

No offense, but I do not think you have answered my question.

My question was: how can I create a CFCOLLECTION, but exclude certain pages?

Your response was: you don't exclude files in cfcollection you exclude files in cfindex
You then pasted 15 pages of documentation (that I have already read).

As far as I can tell, you told me that I used the wrong name for the tag.  You figured that I did not know how to use the tag, so you gave me the documentation for it.

This makes sense, but I already knew where the documentation was, and have read it.  My question was not covered in the documentation, that was why I posted to Experts Exchange.  This post did not answer my question.

I followed up with the question: Please tell me how to exclude files with cfindex.

You said: I am sorry I meant to say you can only exclude file type not files.

I knew that was possible already.  However, I want to exclude Application.cfm but not default.cfm.  This post did not answer my question.

I put some thought into the problem, and found a workaround.  It is not exactly what I want, but it is a solution.

I posted my workaround, and asked for any better ideas.  I thought you (or somebody else) might have some insight into this problem.

You then said that you answered my question.  If you still think you have answered my question, can you show me where?

Matthew
0
 

Accepted Solution

by:
PashaMod earned 0 total points
Comment Utility
Closed, 500 points refunded.
PashaMod
Community Support Moderator
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now