solr8与solr7优势
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented.
有时数据库有数百万条记录,我们需要一种快速查询该表以返回我需要的结果的方法。 当然,您可以使用CFQUERY,但是当有数百万条记录时,它会花费很长时间。 这就是发明SOLR的原因。
Please note, this article was intended for those that have some idea of what Coldfusion and SOLR are, but lack the experience on how to use them together.
请注意,本文适用于那些对Coldfusion和SOLR有所了解的人,但缺乏如何将它们结合使用的经验。
I will be writing a guide soon on how to install SOLR 4.3 with Coldfusion. While Coldfusion comes with SOLR 1.5 built in, 4.3 has much better capabilities.
我将很快编写有关如何在Coldfusion上安装SOLR 4.3的指南。 虽然Coldfusion内置了SOLR 1.5,但4.3具有更好的功能。
First, we need to declare our server host, port, and version.
首先,我们需要声明服务器主机,端口和版本。
<cfset SOLR_SERVER_HOST = 'localhost'>
<cfset SOLR_SERVER_PORT = '8983'>
<cfset SOLR_SERVER_VERSION = '4.3'>
I also like to declare a global variable for each collection name.
我还想为每个集合名称声明一个全局变量。
<cfset endUserCollection = "end_user">
I created the function below called SOLR_SEARCH.
我在下面创建了一个名为SOLR_SEARCH的函数。
<cffunction name="SOLR_SEARCH" returnType="struct" output="yes">
<cfargument name="collection" type="string" required="true" default="">
<cfargument name="criteria" type="string" required="false" default="*:*">
<cfargument name="startrow" type="string" required="false" default="0">
<cfargument name="maxrows" type="string" required="false" default="10">
<cfargument name="sort" type="string" required="false" default="">
<cfargument name="columns" type="string" required="false" default="category,custom1,custom2,custom3,custom4,key,score,size,summary,title,spell">
<cfargument name="facet" type="string" required="false" default="">
<cfargument name="timeout" type="string" required="false" default="10">
<cfargument name="timeAllowed" type="string" required="false" default="10">
<cfargument name="filterQuery" type="string" required="false" default="">
<cfargument name="statsField" type="string" required="false" default="">
<cfset returnStruct = StructNew()>
<cfif NOT IsDefined("timeout") OR NOT IsNumeric(timeout) OR #timeout# LT 1>
<cfset timeout = 10>
</cfif>
<cfif NOT IsDefined("timeAllowed") OR NOT IsNumeric(timeAllowed) OR #timeAllowed# LT 1>
<cfset timeAllowed = 10>
</cfif>
<cfif NOT IsDefined("startrow") OR NOT IsNumeric(startrow) OR #startrow# LT 0>
<cfset startrow = 0>
</cfif>
<cfif NOT IsDefined("maxrows") OR NOT IsNumeric(maxrows) OR #maxrows# LT 1>
<cfset max