簡體   English   中英

如何將Json文件索引到具有多值字段的Solr中

[英]How to Index a Json file into a Solr with multivalued fields

當我嘗試將json文件索引到solr中時,遇到以下錯誤:

SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url: http
://localhost:8983/solr/ontoneo/update
SimplePostTool: WARNING: Response: {
  "responseHeader":{
    "status":400,
    "QTime":16},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"Error parsing JSON field value. Unexpected OBJECT_START at [138], fie
ld=http://www.w3.org/2002/07/owl#intersectionOf",
    "code":400}}
SimplePostTool: WARNING: IOException while reading response: java.io.IOException
: Server returned HTTP response code: 400 for URL: http://localhost:8983/solr/on
toneo/update
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/ontoneo/update...
Time spent: 0:00:00.146

我的json文件的第138行如下所示:

{
  "@id" : "_:genid117",
  "@type" : [ "http://www.w3.org/2002/07/owl#Class" ],
  "http://www.w3.org/2002/07/owl#intersectionOf" : [ {
    "@list" : [ {
      "@id" : "_:genid121"
    }, {
      "@id" : "_:genid119"
    } ]
  } ]
}, 

我對此進行了一些研究,發現問題是多值字段列表。 為了解決這個問題,我將值字段添加到我的收藏集中的文件managed-schema.xml 代碼行如下所示:

<field name="list" type="text_general" multiValued="true" indexed="true" stored="true"/>

但是,當我運行Solr進行索引時,問題仍然存在。 怎么了?

似乎您定義了“ text_general”類型的字段,但隨后將JSON數據傳遞給了索引。 您是要索引“ JSON字符串”而不是JSON對象嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM