我正在我的项目中实现Solr搜索。我有一个关于如何搜索创建在Solr索引中的动态字段的问题。
例如:以下是在索引中形成的标签
我正在尝试使用此查询从Solr搜索 Employee_* = 172,请帮助我确认是否正确。
在查询中,您需要明确定义要搜索的具体字段,例如Employee_a
,Employee_b
(或者您使用的任何动态字段)。您不能通过在查询中的字段名称中使用通配符来搜索所有动态字段。
以下是一种解决方法:
您的schema.xml可能如下所示:
<dynamicField name="Employee_*" type="string" indexed="true" stored="true"/>
<field name="emp_static" type="string" indexed="true" stored="true" multiValued="true"/>
<copyField source="Employee_*" dest="emp_static"/>
select?q=emp_static:"172"