Php 无法在Solr中搜索字段

Php 无法在Solr中搜索字段,php,solr,Php,Solr,在某些字段上使用Solr执行搜索时遇到困难。我使用Solarium作为PHP代码和ApacheSolr搜索服务器之间的“桥梁” 当我搜索“product_name”时,它会成功返回,但如果我搜索style_颜色或style_编号,它不会返回。我已经在模式中对这两个字段进行了“索引”,这使得它们可以搜索 有人能告诉我我做错了什么吗 模式: <field name="product_name" type="text_general" indexed="true" stored="true"/&

在某些字段上使用Solr执行搜索时遇到困难。我使用Solarium作为PHP代码和ApacheSolr搜索服务器之间的“桥梁”

当我搜索“product_name”时,它会成功返回,但如果我搜索style_颜色或style_编号,它不会返回。我已经在模式中对这两个字段进行了“索引”,这使得它们可以搜索

有人能告诉我我做错了什么吗

模式:

<field name="product_name" type="text_general" indexed="true" stored="true"/>
<field name="style_colour" type="string" indexed="true" stored="true"/>
<field name="style_number" type="string" indexed="true" stored="true"/>

Solr Admin“get me everything”查询的结果:


法尔斯
01701901701931
017019
...

在架构中添加以下内容-

<copyField source="product_name" dest="text"/>
<copyField source="style_colour" dest="text"/>
<copyField source="style_number" dest="text"/>

此外,请确保在架构中定义了字段文本。
需要重新为数据编制索引。

使用标准请求处理程序,您的查询将搜索这三个字段

如何查询这些字段?您的默认搜索字段是什么?@Jayendra如何检查我的默认搜索字段是什么?schema.xml文件应该提到defaultsearchfield,它通常是文本字段。您是否也在查询特定字段?solrconfig.xml中是否有特定的请求处理程序?其他详细信息将有助于提供合适的答案。样式字段最初是否没有索引(stored=“false”)?如果是这样,您将需要重新索引数据以使更新的存储值生效。@Jayendra以下内容取自此处讨论的两个文件:schema.xml默认搜索字段部分:
text
solrconfig.xml请求处理程序部分:
explicit 10
I跟踪并解决了此问题,当我使用Solarium时,我不得不深入研究这段代码,发现
Solarium\u Client\u Request\u Select
类将接收我给它的查询字段:
$this->addParam('qf',$component->getQueryFields())。这是通过addDisMax方法发现的(我实际上使用的是eDiscoveryMax),之前,我发现我没有传递style_编号,因此无法搜索。我现在已经在中添加了这个,它现在可以搜索了。非常感谢你的帮助。
<copyField source="product_name" dest="text"/>
<copyField source="style_colour" dest="text"/>
<copyField source="style_number" dest="text"/>