Как использовать custom1, custom2, custom3, custom4 в <cfsearch>с Solr? - PullRequest
1 голос
/ 03 июня 2010

Атрибут custom1, custom2, custom3, custom4 <cfsearch> работает с Solr В документации сказано, что они предназначены только для оператора Verity MATCHES. Как использовать customX с Solr в <cfsearch>?

Спасибо

1 Ответ

4 голосов
/ 03 июня 2010

Да, они делают. Вот пример:

Построение коллекции Строки являются именами столбцов. Например, «ключевые слова» - это допустимый столбец в запросе «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#" />
...