如何在<cfsearch> w / Solr?</cfsearch>中使用custom1,custom2,custom3,custom4

时间:2010-06-03 02:26:16

标签: coldfusion solr coldfusion-9 cfsearch

将{1}的custom1,custom2,custom3,custom4属性与Solr一起使用吗?该文档称它们仅适用于Verity MATCHES运算符。如何在<cfsearch>中使用带有Solr的customX?

由于

1 个答案:

答案 0 :(得分:4)

是的,他们这样做。这是一个例子:

构建集合 字符串是列名。例如,'keywords'是查询“qIndex”中的有效列。

<cfindex collection = "#arguments.collectionName#"
        action      = "REFRESH"
        type        = "CUSTOM"
        body        = "Show_Name, Title"
        key         = "theKey"
        custom1     = "Show_Description"
        custom2     = "keywords"
        custom3     = "Show_ID"
        custom4     = "Asset_ID"
        title       = "Title"
        query       = "qIndex"
        URLPath     = "theURL" />

搜索馆藏

    <!--- Populate the remaining attributes of the cfsearch tag --->
    <cfif !structKeyExists(arguments, 'searchArgs')>
        <cfset arguments.searchArgs = {
             collection         = arguments.collectionName
            ,criteria           = "#arguments.term#"
            ,contextPassages    = "1"
            ,contextBytes       = "1024"
            ,suggestions        = "always"
            ,status             = "searchStatus" } />
    </cfif>
    <!--- Force the name of the result as its referenced only internally --->
    <cfset arguments.searchArgs.name = 'qSearchResults' />

    <!--- Try to search our collection using Solr --->
    <cfsearch attributecollection="#arguments.searchArgs#" />