【问题标题】:Apache solr schema field not displaying in json resultApache solr 模式字段未显示在 json 结果中
【发布时间】:2015-05-14 05:48:29
【问题描述】:

我正在使用 Apache solr-5.1.0 搜索 pdf 文档 我使用 bin/post 方法对所有文档进行了索引。

我添加了一个像 curl 这样的自定义字段

 curl -X POST -H 'Content-type:application/json' --data-binary '{
  "add-field":{
     "name":"ZoneId",
     "type":"strings",
     "indexed" : true,
     "docValues":true,
     "stored":true }
}' http://localhost:8983/solr/taxsutra/schema

现在当我调用搜索查询时,这个 ZoneId 没有显示在 json 结果中。

更新索引的代码:

 curl http://localhost:8983/solr/taxsutra/update/json -H 'Content-type:application/json' -d '
[
 {"id" : "home/niyuj/projects/php/solr-5.1.0/../itat_src/Upload/KOLKATA/Kolkata/24-11-2014/307176844630250930713$5^1REFNOITA_No._1873.2012.pdf", "ZoneId" : "4"},
 {"id" : "/home/niyuj/projects/php/solr-5.1.0/../itat_src/Upload/KOLKATA/Kolkata/24-11-2014/-421302573392022465313$5^1REFNOITA-473-Kol-2014-Mathan-24_11.pdf", "ZoneId" : "5"}
]'

【问题讨论】:

  • 我可以在架构文件中看到 zoneid 字段

标签: php apache solr lucene


【解决方案1】:

我无法确定此信息,但您在搜索查询结果中看不到该字段,因为您没有任何文档包含此字段中的值。要检查这一点,您可以执行以下查询:q=ZoneId:[* TO *]

【讨论】:

  • 感谢您的回复,它给了我 2 个结果,我用 solr api(使用 curl)m 添加了这些结果,但我用 zoneId 更新了索引值之一,但它没有在查询结果中返回跨度>
  • 我正在尝试以这种方式实现,我必须在 apache solr 中索引 pdf 文件,并且我有与这些文件相关的数据库,一旦索引完成,我需要使用数据库字段更新索引值,所以我将数据库字段添加到架构文件(在这种情况下为 zoneId)并尝试使用我的问题描述中给出的代码更新索引,但它创建了新索引,这里唯一的 id 只不过是文件路径,请让我知道我是否走错方向
猜你喜欢
  • 2022-01-08
  • 1970-01-01
  • 2012-12-01
  • 2011-05-10
  • 1970-01-01
  • 1970-01-01
  • 2016-04-08
  • 2013-12-22
  • 1970-01-01
相关资源
最近更新 更多