2013-01-07 29 views
0

这是可能的Solr的索引文件,更可原谅的呢?原谅Solr的索引

目前,我总是得到SolrException如果我尝试索引数据巫不适合的架构百分之百。如果solr能够索引文档并为不正确的字段打印一个例外,那会更好。

+1

恕我直言,你应该尝试修复你的索引过程,而不是... –

+2

也许你会更好的与无模式搜索,如http://www.elasticsearch.org/ –

+0

@Mauricio Scheffer:你是对的关于这一点,但我有一个很大的,有时是一个litte不一致的数据基础。所以我不能指望错误的数据通过solr传递。如果solr可以为我处理它会容易得多。 – Mewel

回答

1

如果你有访问服务器Solr的运行上,可以看到日志的Solr给出了这样的信息。有一个设置,你可以把捕捉所有特定类型的,可以在例如下载

包罗万象的领域内找到的,包含所有其他可搜索文本字段的模式(在该模式通过copyField实施 进一步上

<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/> 
+0

感谢您的答复,但我看不出这能解决我的问题。如果发生错误,catchall字段不会接管。在我的数据库中,我有一个应该只出现一次的字段,但是在一些不一致的数据集中它定义了两次。所以我不想只忽略第二个值,或者忽略整个领域并索引文档。我可以很容易地将该字段设置为多个字段,但我不喜欢那样。 – Mewel

+0

你最好的选择是看日志,因为这会为您提供您所需要的信息。日志会告诉你哪个字段抛出错误,以及为什么数据类型不匹配。 –

0

扩大一点上@Si菲利普的回答如果你看一下附带Solr的分布的例子schema.xml,你会看到如下条目:

<!-- uncomment the following to ignore any fields that don't already match an existing 
    field name or dynamic field, rather than reporting them as an error. 
    alternately, change the type="ignored" to some other type e.g. "text" if you want 
    unknown fields indexed and/or stored by default --> 
<!--dynamicField name="*" type="ignored" multiValued="true" /--> 

<!-- since fields of this type are by default not stored or indexed, 
    any data added to them will be ignored outright. --> 
<fieldtype name="ignored" stored="false" indexed="false" multiValued="true" 
    class="solr.StrField" /> 

这将在您的模式中为任何尚未定义的字段创建动态定义,它们将被忽略。然而,它不会给你任何被忽略的字段/值的指示。

+0

感谢您的回复。我在schema.xml中有这个已经,但是这并没有解决任何多值或错误的字段类型(字符串 - >整数)形式的问题。 – Mewel

+0

我不知道Solr中的任何内容可以为您处理这些类型的错误。 Solr不是数据验证工具,它假定您在加载数据之前正在处理这些类型的问题。在将数据提交给索引进行索引之前,您需要自行解决这些类型的事情。 –