用于显示的cfindex自定义字段无索引

时间:2013-11-30 00:31:34

标签: coldfusion coldfusion-10 cfsearch cfindex

目前正在使用Coldfusion 10和cfsearch。

经过数小时的反复试验,我设法获得cfindex来收集我的所有自定义字段数据,以便我可以将其作为搜索结果页面上输出的字段。

我现在唯一的问题是,搜索将能够搜索真/假字符串之类的内容,并且会在搜索结果中返回。

我可以运行QoQ去除那些,我只是想知道是否有人有任何关于向索引添加字段但没有搜索它们的建议。

任何想法都非常感激

我目前的代码在

之下
<cftry>
<!-- create new searchable collection -->
<!--- cfcollection action= "create" collection="testsearch" path= "#expandPath('/assets/scripts/server/solr/')#" ---->

    <cfcollection action= "list" name="collectionlist">
    <cfdump var="#collectionlist#">

    <cfquery name="MyQuery" datasource="#request.DSN#" maxrows="10">
    SELECT *
    FROM Store_products
    </cfquery>
    <cfdump var="#myQuery#">

<cfset myAttr = structNew()>
<cfset variables.columns = "COST,CREATEDDATE,CUSTOM_MESSAGE,CUSTOM_MESSAGE_LENGTH,DISPLAYNAME,DONTINCLUDEINSTOCKUPDATE,FEATUREDPRODUCT,FINALDAYS,FREEDELIVERY,HEIGHT,HTMLMETADESCRIPTION,HTMLMETAKEYWORDS,IMAGE1,IMAGE10,IMAGE2,IMAGE3,IMAGE4,IMAGE5,IMAGE6,IMAGE7,IMAGE8,IMAGE9,ISBUNDLE,ISNEWPRODUCT,ISONLINE,ISONSALE,ISSILENT,LONGDESCRIPTION,MANUFACTURER,NOVOUCHERS,ONLINEEXCLUSIVE,PARTNUMBER,PRICE,PRICELEVEL1,PRICELEVEL10,PRICELEVEL11,PRICELEVEL12,PRICELEVEL13,PRICELEVEL14,PRICELEVEL15,PRICELEVEL2,PRICELEVEL3,PRICELEVEL4,PRICELEVEL5,PRICELEVEL6,PRICELEVEL7,PRICELEVEL8,PRICELEVEL9,PRODUCTCATEGORY,PRODUCTCOLOR,PRODUCTMATERIAL,PRODUCTNAME,PRODUCTSIZE,PRODUCTSTYLE,PRODUCTTITLE,PRODUCTVIEWS,RRP,SALEEND,SALEPRICE,SALESTART,SHORTDESCRIPTION,SOLDOUT,STOCKQUANTITY,STORESORTORDER,TAXEXEMPT,VOLUME,WEIGHT,WIDTH">
<cfloop from="1" to="#ListLen(variables.columns,',')#" index="idx">
    <cfset myAttr[listGetAt(variables.columns,idx,',') & "_s"] = listGetAt(variables.columns,idx,',') >
</cfloop>

<cfindex attributecollection="#myAttr#" action="update" collection="testsearch" type="custom" body="DISPLAYNAME,HTMLMETADESCRIPTION,HTMLMETAKEYWORDS,LONGDESCRIPTION,MANUFACTURER,PARTNUMBER,PRODUCTNAME,PRODUCTTITLE,RRP,SHORTDESCRIPTION" query="MyQuery" key= "productname">

<cfsearch name="searchResults" collection="testsearch" criteria="false" >
<cfdump var="#searchResults#">



<cfcatch type="any">
    <cfdump var="#cfcatch#">
</cfcatch>
</cftry>

0 个答案:

没有答案