[英]ColdFusion PDF file search using cfsearch and SOLR extremely slow
我有一個運行正常的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-Adobe ColdFusion 9.0.1和1GB RAM的開發VM。 JVM是Sun Microsytems(14.3-b01)。 服務器端幾乎沒有其他任何東西在運行,因此性能應不受外部因素的影響。
它正在提供預期和完美的結果,只是沒有及時。
您可以嘗試使用CFSolrLib 。 它使用Solr API。 繞過<cfsearch>
可能會提高性能
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.