Adobe ColdFusion 8

cfcollection

描述

. 创建和管理对Verity搜索引擎的连接。

类别

可扩展性标签

语法

<cfcollection 
    action = "action"
    categories = "yes|no"
    collection = "collection name"
    language = "language"
    name = "query name"
    path = "c">

注意: 你可以在属性选择框里面制定这个标签的属性,这个属性选择框本身是一个结构。在属性选择框里面指定属性的名字,并且使用标签的属性名作为结构的关键字。

cfexecute, cfindex, cfobject, cfreport, cfsearch, cfwddx

历史

ColdFusion MX 7:

  • ColdFusion MX 7创建起始就存在这个标签,你不能用cfcollection标签在已经存在的收藏里创建别名。( you cannot use the cfcollection tag to create alias names for already existing collections. )因为Verity包含了所有收藏的信息,同一个收藏不能有两个指向它的名字。(Because Verity maintains all the collection information, you cannot have two names point to the same collection.)
  • (Removed reference to external collections.)给外部的收藏变更参考。
  • (Deprecated the map and repair options of the action attribute. They might not work, and might cause an error, in later releases.)action属性的已废弃的类别属性和修复选项。他们也许不能运行,还会导致一个错误。
  • (Added categories attribute and categorylist action.)添加了类别属性和categorylistaction
  • (Added CATEGORIES, SIZE, DOCCOUNT, and LASTMODIFIED to list of variables returned by the list action.)通过list action给变量的清单添加了类别,型号,DOCCOUNT和 LASTMODIFIED 。
  • (Marked as obsolete the MAPPED, ONLINE, and REGISTERED variables returned by the list action.)标记已经过时的由list action返回的 MAPPED, ONLINE, 和 REGISTERED 变量。

ColdFusion MX:

  • (Changed the requirements for the action attribute: it is now required. )action属性的要求已经改变: 它现有有要求。
  • (Added the action attribute list value. It is the default).添加了action属性的清单值。现在它是默认值
  • Changed the requirements for the action attribute value map: it is not necessary to specify the action attribute value map. (ColdFusion detects collections and creates maps collections as required.)改变了action属性值map的要求:现在它不需要指定action属性的值map。(ColdFusion侦测到了收藏,并按照要求创建了map收藏。)
  • (Changed acceptable collection naming: this tag accepts collection names that include spaces.)改变了可接受的收藏的名字:这个标签接受包含有空格的收藏名。
  • (Changed Verity operations behavior: ColdFusion supports Verity operations on Acrobat PDF files).改变了Verity的运行方式:ColdFusion支持Verity在Acrobat PDF 文件上得到运行方式。
  • (Changed thrown exceptions: this tag can throw the SEARCHENGINE exception.)改变了thrown exceptions:这个标签可以throw SEARCHENGINE exception,

Attributes

属性

必选/可选

默认

描述

action

要求; 请看使用方法

list

  • categorylist:从收藏里面检索并且显示每一个检索结果里有多少文件。返回一个 类别里一个代表性的结构。对于类别树的一个类别来说,文件的数量就是这个水平线或者水平线之下的文件的数量。(categorylist:retrieves categories from the collection and indicates how many documents are in each one. Returns a structure of structures in which the category representing each substructure is associated with a number of documents. For a category in a category tree, the number of documents is the number at or below that level in the tree. )
  • (create: registers the collection with ColdFusion. If the collection is present, the tag creates a map to it. If the collection is not present, the tag creates it. )创建:用ColdFusion登记收藏。如果确实有收藏,这个标签就会创建一个map来对应。如果收藏 不存在,那么标签就会创建收藏。
  • (delete: unregisters a collection and deletes its directories.)删除:插销收藏的登记,删除收藏的目录。
  • (list: returns a query result set, named from the name attribute value, of the attributes of the collections that are registered by ColdFusion.)清单:返回一个query的结果,从名字属性值里面命名,属于被ColdFusion登记的收藏的属性之一。
  • (map: creates a map to a collection. If the action is create and the collection already exists, ColdFusion also creates a map to the collection.)map: 创建一个收藏得到map。如果这个 action已经被创建,而且收藏也已经存在,那么ColdFusion同样也会创建一个map给这个收藏。
  • (optimize: optimizes the structure and contents of the collection for searching; recovers space. Causes collection to be taken offline, preventing searches and indexing.)优化:优化结构和用来搜索的收藏的内容。收回空间。使得收藏可以下线,保护搜索和indexing。
  • (repair: deprecated. Does nothing.)修理:已经废弃,不再使用。 没有任何作用

categories

请看使用方法

no

Used only for creating a collection:只适用于创建一个收藏:

  • (yes: this collection includes support for categories.) yes:这个收藏包括了类别的支持。
  • (no: this collection does not support categories.) no:这个收藏不支持类别。

collection

请看使用方法

 

  • A collection name. The name can include spaces. 所有的收藏的名字。这些名字可以包含空格。

language

请看使用方法

English

Although English is the default language, Englishx, a more advanced English locale, is also provided. For a list of options, see Usage.

Requires the appropriate (European or Asian) Verity Locales language pack.虽然英语是默认的语言。但是,Englishx,作为一种更高级的现场语言,也同样可以使用。更多的可选清单,请看使用方法。

name

请看使用方法

 

Name for the query results returned by the list and categorylist actions.被清单和categorylist action返回的query结果的名字。

path

请看使用方法

 

Absolute path to a Verity collection. 通往一个Verity收藏的绝对路径。

(To map an existing collection, specify a fully qualified path to the collection (not including the collection name); for example, "C:\MyCollections\".)一个存在的收藏的map,指向收藏的一个完整的合格的路径,例如:"C:\MyCollections\".

使用方法

用这个标签你可以创建,登记和管理一个Verity收藏,而这个Verity收藏是用ColdFusion或者一个Verity应用程序创建的。(With this tag you can create, register, and administer a Verity collection that was created by ColdFusion or by a Verity application.)

The following table shows the dependence relationships among this tag's attribute values:下面的表格显示了这个标签值之间的依赖关系:

这个属性是必选的可选的或者可以使不必要的。(This attribute is required, optional, or unnecessary (blank):)

For this action attribute value:这个action属性的值

清单

创建

map

optimize

repair

删除

categorylist

collection

 

必选

必选

必选

必选

必选

必选

path

 

必选

必选

 

 

 

 

language

 

可选

可选

 

 

 

 

name

必选

 

 

 

 

 

必选

categories

 

 

 

 

 

 

 

The following examples show the structures returned by the categorylist action:下面的例子显示了被 categorylist action返回的结构:

CATEGORIES

blue

10

green

3

magenta

3

purple

2

CATEGORYTREES

a/

10

a/b

10

a/b/c

10

a/b/c/subdir

3

The list action returns the following information in a result set that contains one row per collection: 这个清单返回了按照要求每行列出一个收藏的结果里面的信息:

栏目

内容

CATEGORIES

  • yes: the collection has category support enabled. 这个收藏被类别支持。
  • no: the collection does not have category support enabled. 这个收藏没有被类别支持

CHARSET

The character set of the collection.收藏的文字分类。

CREATED

The date and time that the collection was created.收藏被创建时的日期和时间。

DOCCOUNT

The number of documents in this collection.收藏里的文件数目。

EXTERNAL

  • yes: the collection is external. 这个收藏是外部的。
  • no: the collection is not external. 这个收藏不是外部的。
  • not found: the collection is registered but is not available in the defined path . 不可见:这个收藏已经登记但是在指定的路径不可使用。

LANGUAGE

The locale setting of the collection. 收藏的现场设置。

This information is not available for K2Server collections.这些信息对于 K2Server 收藏来说不可用。

LASTMODIFIED

The date and time that the collection was last changed.收藏被修改的最新日期和时间。

MAPPED

Obsolete.已经过期。

NAME

The name of the collection. 收藏的名字

ONLINE

Obsolete.已经过期。

PATH

Absolute path to the collection. 收藏的绝对路径

REGISTERED

Obsolete.已经过期。

SIZE

The size of the collection, expressed in kilobytes.在kilobytes里面被压缩的收藏的大小。

(You can also specify uni to enable support for multiple languages).你也可以指定uni来支持multiple语言。

(The ColdFusion Administrator Verity > Collections page displays the information that is returned when you use the list attribute.) ColdFusion Administrator Verity > Collections 页面显示了当你使用清单属性的时候返回的信息。

If the Verity Server is not running when the list action is executed, the tag throws an error.如果当清单action运行的时候,Verity Server没有运行, 这个标签就会提示错误。

(To determine whether a collection exists, use code, such as the following, to execute a query of queries:)为了确定一个收藏是否存在,你可以使用代码,来运行一个queries的query:

<cfcollection action="list" name="myCollections" > 
<cfquery name="qoq" dbtype="query">
    SELECT * from myCollections 
    WHERE myCollections.name = 'myCollectionName'
    </cfquery> 
<cfif qoq.recordcount GT 0>
    <!--- Collection exists --->
    <cfdump var = #qoq#>
</cfif>

(To get a result set with values for all the collections that are registered with the Verity server, use code such as the following:)通过Verity server登记的所有收藏的值有个结果,为了得到这个结果,你可以使用以下的代码:

<cfcollection action="list" name="myCollections">
<cfoutput query="myCollections">
    #name#<br>
</cfoutput>

(To add content to a collection, use cfindex. To search a collection, use cfsearch.)给一个收藏添加内容,可以使用 cfindex.搜索一个收藏,可以使用cfsearch.

You cannot delete Verity collections on Windows if they are created outside of the ColdFusion collections directory or on a drive other than C:, D: or E:. To use a different drive letter, edit the cf_dir/verity/common/verity.cfg file and replace an entry with the directory you wish to use as follows:如果Verity收藏是在ColdFusion收藏目录外创建的,或者是在c盘,d盘或者e盘外创建的, 你不能在Windows上删除Verity收藏。要使用一个不同的 drive letter,需要编辑 cf_dir/verity/common/verity.cfg文件,并且替换一个带有你想用的目录的entry。

alias11=path6
mapping11=F:\
dirmode11=rw

Restart the ColdFusion Search Service for this change to take affect.重新启动ColdFusion Search Service让所做的改变开始运行。

The language attribute of this tag supports the following options: 这个表亲的语言属性支持以下的选择:

Asian Language Pack

Japanese

Korean

Chinese

Traditional Chinese

Multilanguage Language Pack

Unicode

 

 

 

Western European Language Pack

Bokmal

Finnish

Italian

Spanish

Danish

French

Nynorsk

Swedish

Dutch

German

Portuguese

 

Eastern European/Middle Eastern Language Pack

Arabic

Greek

Polish

Turkish

Bulgarian

Hebrew

Russian

 

Czech

Hungarian

Russian2

 

The default location of Verity collections is as follows:Verity收藏默认的位置如下:

  • Server 配置:
    • Windows: C:\CFusionMX7\verity\collections
    • UNIX system: /opt/coldfusionmx7/verity/collections
  • J2EE 配置: webapp_root/WEB-INF/cfusion/verity/collections

例子

<!-------------------------------------------------------------------------
(coll_actn.cfm)
Check for server platform and use its default Verity Collection directory.
If you did not install ColdFusion in the default directory, or if you use
the J2EE configuration, or if your webroot is not C:\CFusionMX7\wwwroot, you
might need to change the path in this example. For example, for JRun4 the path
might be C:\JRun4\Verity\Collections\
--------------------------------------------------------------------------->
<cfif Find("Windows", Server.OS.Name)>
    <cfset collPath = "C:\JRun4\Verity\Collections\">
<cfelse>
    <cfset collpath = "/opt/coldfusionmx7/verity/collections/">
</cfif>

<!--------------------------------------------------------------------------
Process form input and do the requested cfcollection operation. 
--------------------------------------------------------------------------->

<cfif IsDefined("form.CollectionName") AND IsDefined("form.CollectionAction")>
    <cfif form.CollectionName is not "">
        <cfswitch expression="#FORM.CollectionAction#">
        <cfcase value="Create">
        <cfcollection action="CREATE" collection="#FORM.CollectionName#"
                    path="#collPath#" categories="yes">
        <h3>Collection created.<br>
            Use CFINDEX to populate it.</h3>
        </cfcase>
        <cfcase value="Repair">
        <cfcollection action="REPAIR" collection="#FORM.CollectionName#">
        <h3>Collection repaired.</h3>
        </cfcase>
        <cfcase value="Optimize">
        <cfcollection action="OPTIMIZE" collection="#FORM.CollectionName#">
        <h3>Collection optimized.</h3>
        </cfcase>
        <cfcase value="Delete">
        <cfcollection action="DELETE" collection="#FORM.CollectionName#">
         <h3>Collection deleted.</h3>
        </cfcase>
        </cfswitch>
    <cfelse>
    <h3>Please enter a name for your collection</h3>    
    </cfif>
</cfif>

<!--------------------------------------------------------------------
(coll_form.cfm)
Form to specify the collection name and action
    coll_form.cfm
--------------------------------------------------------------------->

<form action="coll_actn.cfm" method="POST" >
<select name="CollectionAction">
    <option value="Create">Create this collection
    <option value="Optimize">Optimize this collection
    <option value="Repair">Repair this collection
    <option value="Delete">Delete this collection
</select>

<p><strong>Collection on which to act</strong><br>
Use the default value or enter your own Collection name<br>
<input type="Text" name="CollectionName" value="My_coll"></p>

<input type="Submit" name="" value="alter or create my collection">
</form>