【发布时间】:2014-02-11 05:35:00
【问题描述】:
我正在尝试在 Solr 中为 JSON 文件编制索引并且它可以工作,但我不明白为什么 Solr 将元素索引为数组而不是元素。
当我索引示例 json 文件“books.json”时,它工作正常,但如果我索引另一个文件“items.json”,它会生成不同的输出。
我在下面显示:
Books.json
[{
"id" : "978-0641723445",
"cat" : ["book","hardcover"],
"name" : "The Lightning Thief",
"author" : "Rick Riordan",
"series_t" : "Percy Jackson and the Olympians",
"sequence_i" : 1,
"genre_s" : "fantasy",
"inStock" : true,
"price" : 12.50,
"pages_i" : 384
}]
OUTPUT
{
"id": "978-0641723445",
"cat": [
"book",
"hardcover"
],
"name": "The Lightning Thief",
"author": "Rick Riordan",
"author_s": "Rick Riordan",
"series_t": "Percy Jackson and the Olympians",
"sequence_i": 1,
"genre_s": "fantasy",
"inStock": true,
"price": 12.5,
"price_c": "12.5,USD",
"pages_i": 384,
"_version_": 1457847842153431000
},
Items.json
[{
"title" : "Pruebas Carlos",
"id" : 14,
"desc" : "Probando como funciona el campo de descripciones"
}]
OUTPUT
{
"title": [
"Pruebas Carlos"
],
"id": "10",
"desc": [
"Probando como funciona el campo de descripciones"
],
"_version_": 1457849881416695800
},
My Schema,我只添加了我需要的新字段。
有人可以向我解释如何在没有 [] 的情况下索引元素吗?
谢谢
【问题讨论】:
-
您能否编辑您的问题并添加该核心的
schema.xml? -
完成,我上传到 pastebin