views:

149

answers:

1

do custom1, custom2, custom3, custom4 attribute of <cfsearch> work with Solr? The documentation said they're only for Verity MATCHES operator. How to use customX with Solr in <cfsearch>?

Thanks

+4  A: 

Yes, they do. Here is an example:

Building the collection The strings are column names. For example 'keywords' is a valid column in the query "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" />

Searching the Collection

    <!--- 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#" />
Aaron Greenlee
custom1:NNNNN is what I was looking for, but thx for this answer! http://www.coldfusionjedi.com/index.cfm/2009/8/20/Simple-ColdFusion-9-ORMSolr-Example#cE7688874-BD22-6488-43366AA9AE724CF7
Henry
Sorry, I misunderstood. For future reference, here is a direct link to the docs where the syntax is outlined: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS82937B1B-240F-4850-B376-5FD9F911E5E5.html
Aaron Greenlee