我有四个文件[一个.PDF,一个.doc和两个.docx]。我使用ColdFusion Administrator创建了一个名为" testCollection" 的ColdFusion集合。在Manage ColdFusion Collection屏幕中,我输入了File Extensions [.pdf,.doc,.docx]和放置所有4个文件的目录路径。同时选中复选框[递归索引子目录]。点击提交后,我可以在Solr Collections中看到5个文件大小。
之后我在下面写了一个cfm文件,根据他们的内容搜索文件 的 Search.cfm
<cfcollection action="list" name="AllSolrCollections" engine="solr">
<!--- Filter to the collection that this application uses. --->
<cfquery name="chkSolrCollection" dbtype="query">
select * from AllSolrCollections
where AllSolrCollections.name = 'testCollection'
</cfquery>
<cftry>
<cfif chkSolrCollection.recordcount EQ 1>
<cfsearch name="mySearch" collection="testcollection" criteria="Aged" startrow=1>
</cfif>
<cfcatch type="SearchEngine">
<cfoutput>Error</cfoutput>
</cfcatch>
</cftry>
<cfdump var="#mySearch#">
当我输入标准&#34; Aged&#34;它给了我正确的结果并显示除一个文件&#34; Search_Not_Show_For_Aged.docx&#34; 以外的所有文件,因为它没有搜索条件内容&#34; Aged&#34;。
我的问题是当我输入标准&#34;吸烟&#34; 时,它没有给我正确的结果。它显示除一个文件&#34; Search_Not_Show_For_Smoking.docx&#34; 之外的所有文件,但此文件包含&#34;吸烟&#34;字。 我将文件放在Dropbox中并分享here
请建议并帮助解决此问题。
由于
答案 0 :(得分:0)
如果我们确实优化了集合,搜索就可以了。我们可以使用coldfusion管理或使用coldfusion代码来优化收集。
使用coldfusion管理优化收集: