solr - Solr 7.4.0 将所有带有 copyfield 的字段搜索到默认字段中不起作用
问题描述
我查看了许多类似的问题。答案是将所有字段复制到一个字段并将其设置为默认字段。但是,它仍然无法正常工作。
我的一些领域:
<field name="Unit" type="string" docValues="true" indexed="true" stored="true"/>
<field name="Amount" type="pdoubles" docValues="true" indexed="true" stored="true"/>
<field name="Comment" type="text_general" docValues="true" indexed="true" stored="true"/>
我加:
<field name="searchall" type="text_general" multiValued="true" indexed="true" stored="true"/>
(我也尝试了 stored="false" 但它们都不起作用)并通过模式 API 在托管模式下添加我需要的所有复制字段。
然后我变了
<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
<lst name="defaults">
<str name="df">searchall</str>
</lst>
</initParams>
在 solrconfig.xml 中
当我搜索 q=something 时,它仍然没有给出任何信息。有谁知道我哪里做错了?
解决方案
正如 MatsLindh在评论中提到的,不要忘记重新索引。
添加您的复制字段 - 如果您明确引用该字段而不是使用它是否有效
df
?更改配置后是否重新索引?如果您在添加 copyField 指令后没有重新索引,那么目标字段中将没有任何内容。复制操作发生在文档被索引时。
我重新导入数据并且它有效。
推荐阅读
- angular - 如何在材质工具栏上自定义背景颜色?
- ios - “insetGrouped”样式的单元格预览的圆角(iOS 13)
- java - if then else 语句的替代方案
- perl - 使用 perl 更改时间戳的格式
- python - 我的矢量化项目不起作用。我将如何解决这个问题
- javascript - 我无法在 prisma 架构问题中部署更改
- php - 如何在 Magento 2 中创建带有产品编辑页面下拉菜单的自定义按钮?
- rust - 如何在不使用第三方库的情况下对除第一个和最后一个元素之外的向量进行洗牌?
- c - 在 C 中使用 2D 数组进行简单 I/O 时变量值发生变化,导致分段错误
- javascript - Django 在 ajax 中回复评论不起作用