solr8与solr7优势_与SOLR一起使用Coldfusion

本文介绍了如何结合使用Coldfusion和SOLR以提高大数据查询效率。相较于内置的SOLR 1.5,作者建议升级到SOLR 4.3,因为它提供了更强大的功能。通过示例展示了SOLR_SEARCH函数的用法,用于快速查找用户信息,并强调了SOLR查询速度远超CFQUERY,且具备内置的统计功能。文章适合有一定Coldfusion和SOLR基础的读者。
摘要由CSDN通过智能技术生成

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值