我们如何创建自定义 solr 索引和自定义 lucen 索引以在露天搜索文档?

How we can create custom solr indexing and custom lucen indexing to search documents in alfresco?

其实我参加过一些露天的采访,但我经常收到这个问题,如何创建自定义索引以及如何重新索引文档。

我用谷歌搜索了它,但没有找到任何有用的答案,或者我仍然无法理解它到底是什么以及如何做?

任何人都可以帮助我理解我们必须为自定义索引做的必要配置吗?

提前致谢

1/ 让我们承认您创建了自己的模型并希望选择如何自定义字段的索引

我的解释将基于此页面:http://docs.alfresco.com/5.0/concepts/search-fts-config.html 和 mor particullary 这部分:

Data dictionary options

The indexing behavior of each property can be set in the content model. By default, they are indexed atomically. The property value is not stored in the index, and the property is tokenized when it is indexed. The following example shows how indexing can be controlled.

Enabled="false" If this is false, there will be no entry for this property in the index.

Atomic="true" If this is true, the property is indexed in the transaction, if not the property is indexed in the background.

facetable="true" If true, the property will be used for faceting and if false, you cannot use it for faceting.

Tokenised="true" If "true", the string value of the property is tokenized before indexing. if "false", it is indexed "as is" as a single string. if "both" then both specified forms are in the index.

基本上,如果 enabled 为真,则意味着该字段将是可搜索的。

如果 tokenized 为真,这意味着(简而言之)如果您只查看一部分:

如果

,值为 "Blue cat" 的字段将是 return
  • 它被标记化并查询了单词"cat"或"blue"
  • 它没有标记化,将询问确切的句子 "Blue cat"。 文档内容一般都是分词的,这就是为什么你不能通过内容找到文档,只有几个字。

2/ 让我们承认您想更改数据类型分析器:

对于每种数据类型,选择一个分析器来处理相应的字段。您可以在此处查看配置文件:https://github.com/Alfresco/community-edition/tree/master/projects/system-build-test/config/alfresco/model

在默认配置文件(dataTypeAnalyzers.properties)中,您可以看到(例如)文本字段由 AlfrescoStandardAnalyser 处理。 现在,由于我使用法语语言环境配置了我的 Alfresco,我的 Alfresco 将使用 dataTypeAnalyzers_fr.properties 文件覆盖此行为,因此文本字段将由 FrenchAnalyzer 处理。 这个分析器对我来说更好,因为它处理了一些法国的特殊性。如果需要,您可以用滚雪球覆盖此分析器(具有不同的行为)。

3/ 让我们承认您有技术需求,您想自定义您的 Solr 配置

我的解释仍将基于此页面:http://docs.alfresco.com/5.0/concepts/search-fts-config.html

Solr 4 index properties

solr.host=localhost The host name where the Solr instance is located.

solr.port=8080 The port number on which the Solr instance is running.

solr.port.ssl=8443 The port number on which the Solr SSL support is running.

solr.solrUser=solr The Solr user name.

solr.solrPassword=solr The Solr password.

solr.secureComms=https The HTTPS connection.

solr.solrConnectTimeout=5000 The Solr connection timeouts in ms.

solr.solrPingCronExpression=0 0/5 * * * ? * The cron expression defining how often the Solr Admin client (used by JMX) pings Solr 4 if it goes away.

如果需要,您可以更改一些 Solr 参数。我不会再继续下去了,因为我觉得这不是你要找的。

4/ 对于重新索引部分,我不会具体说明,因为 Gagravarr 已经给了你文档 link : http://docs.alfresco.com/5.1/tasks/solr-reindex.html 请记住,索引是可重构的,因此您只需删除索引文件夹即可开始重建索引。

最后我只想说我只介绍了索引主题的一小部分。由于这是一个巨大的领域,我们确实需要您说明您的需求,以便为您提供正确的答案。