2010-06-07 56 views
1

我已经导入文档到Solr的有从模式(多为* _s)动态创建的领域。在后端(/ solr/admin)中,我可以看到它们存在:聚合统计信息(如术语频率)显示正确。它们全部列为存储的索引&。Solr的不搜索(动态创建的)字段

然而,它们不会出现在查询中,甚至当我搜索在所有领域,例如:

/solr/select/?indent=on&q=myterms&fl=* 

这个问题似乎类似于SOLR not searching on certain fields,我试图解决方案出现,后者为:

如果你想你的标准查询处理程序来搜索对所有的字段,你可以在你的solrconfig.xml中改变它(我随时补充而不是修改“标准”第二查询处理程序。在佛罗里达州字段是字段列表你要搜索,这是一个用逗号分隔的列表或*。

我对标准solrconfig.xml进行了更改,但仍然没有任何结果。

我试图创建一个非常简单的文档:

{'id':5, 'name':'foo'} 

而这个查询将返回DOC:

/solr/select/?indent=on&q=foo&fl=* 

查询没有结果,整个结果看:

<response> 
− 
<lst name="responseHeader"> 
<int name="status">0</int> 
<int name="QTime">1</int> 
− 
<lst name="params"> 
<str name="echoParams">all</str> 
<str name="h1">true</str> 
<str name="defType">dismax</str> 
<str name="indent">on</str> 
<str name="start">0</str> 
<str name="q">Foo</str> 
<str name="version">2.2</str> 
<str name="rows">10</str> 
</lst> 
</lst> 
<result name="response" numFound="0" start="0"/> 
</response> 

回答

2

您的“标准”查询处理程序的deftype是否是dismax?如果没有,那么它将无法工作。作为你提供的问题的答案,你必须使用dismax来搜索多个领域。如果你不希望使用dismax,但还是要在一次许多字段进行搜索,您必须使用拷贝字段功能在索引时间收集所有你想要搜索的到一个字段,然后等领域做出这一领域的默认字段。

+0

我使用dismax,但仍然没有得到结果。我已经用整个回复更新了我的帖子。 – 2010-06-25 19:15:24

+0

是否在dismax配置的qf参数中列出了字段“名称”?它必须是因为“foo”在该字段中被索引。 – 2010-06-25 20:00:27

+0

这是 - 我的dismax配置复制在这里:http://gist.github.com/453487 – 2010-06-25 21:36:28

0

我看你使用查询“富”,而name值是“富”。您可能要检查,如果你lowercase条款中去索引和查询您的模式的字段类型,你正在使用name

2

由于您使用_s你可以复制这些领域的“文本”在solr/collection1/conf/schema.xml这样的:

<copyField source="*_s" dest="text" maxChars="3000"/> 

这是一个微小的变化在Why do dynamic fields not act like normal fields (specifically when querying and displaying in Hue) in solr?这是解决去掉这一*_t行:

<!-- Above, multiple source fields are copied to the [text] field. 
     Another way to map multiple source fields to the same 
     destination field is to use the dynamic field syntax. 
     copyField also supports a maxChars to copy setting. --> 

<!-- <copyField source="*_t" dest="text" maxChars="3000"/> --> 

这使我的动态字段搜索有:

curl http://localhost:8983/solr/collection1/select?q=foo 

这里是那里的 “包罗万象” 的text字段描述:

<!-- catchall field, containing all other searchable text fields (implemented 
    via copyField further on in this schema --> 
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/> 

又见http://wiki.apache.org/solr/SchemaXml#Copy_Fields