solr - cfindex 我们可以有多少个自定义字段

标签 solr coldfusion coldfusion-10

我目前正在使用 cfsearch 为我的站点整合一个搜索功能。我们使用的是 CF 10,所以我相信它可以在 Solr 上运行。

在 cfindex 标签中,我可以看到我们可以添加一些自定义字段,但是由于我们的搜索要返回大量信息,我想知道我们如何才能让额外的字段作为返回的一部分可用数据集?

目前我们有 custom1 - custom4 被数据库查询中的一些字段填充,但我们仍然需要额外的属性在搜索运行时提供给用户或在模板中。

有什么方法可以将超过 4 个自定义字段添加到 cfindex 吗?

提前致谢

最佳答案

Adobe 对 ColdFusion 10 中的 Solr 实现进行了改进,因此它不再具有 cfindex 的自定义字段限制。以前版本的 ColdFusion 有。即 - custom1、custom2、custom3 和 custom4。像往常一样,online documentation for the tag只是从以前的版本继承而来,所以有点困惑。

有关更多信息,请参阅此文档 - Solr enhancements in ColdFusion 10 .
从该文档的存储您的自定义数据部分:

Variations from ColdFusion 9

  • ColdFusion 9 had limited support for custom fields namely custom1, custom2, custom3, and custom4. In ColdFusion 10, custom fields are dynamic.
  • In ColdFusion 9, all custom fields are displayed. In ColdFusion 10, cfdump yields only fields that have data{{}}. That is, if you have specified only custom 1 and custom 2, only those two fields are displayed.
  • Consider the following code:

    <cfsearch criteria='some_criteria and column_i: [ 10 - 20 ]'...>

    Here, some_criteria indicates filtering. For example column_i: [ 10 - 20 ] means search all items whose values are between 10 and 20. column_i is the custom field provided by user while indexing. This option was available in ColdFusion 9, but limited to four custom fields. In ColdFusion 10, the options are unlimited.

  • In ColdFusion 10, you can sort the order in which search results have to be returned.

Note: When you search a Solr collection for field type string, the criteria should be within quotes, for example criteria='string_s:"something missing"'


To specify custom fields, use the following syntax:

<cfindex ... 
   datefield_dt=#date1# 
   column_i=#secondaryColumn# 
   body=#primaryColumn# 
   ....../>

Note Custom fields can contain only lower case characters.

In the code, _i stands for integer custom data whose value is stored and indexed. Any field name that ends with _i is treated as a Solr integer. Similarly, _s stands for string custom data.

All the supported datatypes are listed in the schema.xml:

<dynamicfield name="*_i" type="sint" indexed="true" stored="true"/> 
<dynamicfield name="*_s" type="string" indexed="true" stored="true"/> 
<dynamicfield name="*_l" type="slong" indexed="true" stored="true"/> 
<dynamicfield name="*_t" type="text" indexed="true" stored="true"/> 
<dynamicfield name="*_b" type="boolean" indexed="true" stored="true"/> 
<dynamicfield name="*_f" type="sfloat" indexed="true" stored="true"/> 
<dynamicfield name="*_d" type="sdouble" indexed="true" stored="true"/> 
<dynamicfield name="*_dt" type="date" indexed="true" stored="true"/> 
<dynamicfield name="random*" type="random"/>

Note: _dt supports only the date formats supported by ColdFusion.

关于solr - cfindex 我们可以有多少个自定义字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20207883/

相关文章:

java - 按分数限制 SOLR 中的结果数量

search - solr 可以返回函数值(不是 solr 分数或文档字段)吗?

solr - solr 查询字符串中的负运算符(NOT,- , !)不适用于括号

coldfusion - Application.cfc : this. debugipaddress 和this.debuggingIPAddresses,有什么区别?

mysql - SQL 引用 WHERE 子句中的别名

coldfusion - CFInclude vs Custom Tag vs CFC 用于演示和安全性

solr - 使用 SolrNet 从控制台应用程序查询 Solr?

coldfusion - 在 ColdFusion 中循环结构时如何检查最后一项?

json - ColdFusion > 2016. SerializeJSON 保留具有重复项的顺序

java - 如何在 Coldfusion8 中使用 javaloader 设置 java 库?