使用cfsearch和SOLR的ColdFusion PDF文件搜索速度极慢

我有一个功能正常的Adobe ColdFusion应用程序,它通过Solr搜索索引大约2k个PDF文件,并提供预期的结果 – 但是每个搜索查询到该集合通常需要25-30秒.

这就是我将2k PDF文件索引到Solr的方法:

<!--- query database files --->
<cfset getfiles = application.file.getfiles()>

<!--- create solr query set --->
<cfset filesQuery = QueryNew("
    fileUID
    , filepath
    , title
    , description
    , fileext
    , added
")>

<!--- create new file query with key path and download url --->
<cfoutput query="getfiles">
<cfset ext = trim(getfiles.fileext)>
<cfset path = expandpath('/docs/#fileUID#.#ext#')>

<cfscript>
    newRow = QueryAddRow(filesQuery);
    QuerySetCell(filesQuery, "fileUID","#fileUID#" );
    QuerySetCell(filesQuery, "filepath","#path#" );
    QuerySetCell(filesQuery, "title","#filename#" );
    QuerySetCell(filesQuery, "description","#description#" );
    QuerySetCell(filesQuery, "added","#added#" );
</cfscript>

</cfoutput>

<!--- index the bunch --->
<cfindex  
    query = "filesQuery" 
    collection = "resumes" 
    action = "update" 
    type = "file" 
    key = "filepath"     
    title = "title" 
    body = "title, description"
    custom1 = "fileext"
    custom2 = "added"
    category= "file"
    status = "filestatus"> 

这是搜索文件的方式以及(25-30秒)Solr搜索发生的位置:

<!--- imagine form with (form.search) for terms --->

<cfsearch name = "results" 
    collection = "resumes" 
    criteria = "#form.search#
    contextPassages = "1"
    contextBytes = "300"
    maxrows = "100"
    contextHighlightBegin = "<strong>"
    contextHighlightEnd = " </strong>">

<!--- show (results) query --->

关于项目的一些额外信息:所有文件的长度都不到1页,因此在为Solr创建索引结果时没有字符截止.我在ColdFusion Administrator中使用了Solr缓冲区限制,没有明显的时间变化(目前为40).我使用的是MS Server 2003的开发虚拟机,1.86 Xeon – Adob​​e ColdFusion 9.0.1和1GB RAM. JVM是Sun Microsytems(14.3-b01).几乎没有其他东西在服务器端运行,因此性能应该不受外部因素的影响.

它提供了预期和完美的结果,而不是及时.

最佳答案 您可以尝试使用
CFSolrLib.它使用Solr API.通过绕过< cfsearch>可以获得性能提升.

点赞