我想索引一個JSON文件在Solr中,它的工作原理,但我不明白爲什麼Solr索引元素作爲一個數組而不是元件。Solr索引json,它索引爲列表而不是作爲項目
當我索引示例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'? – cheffe
完成後,我將它上傳到pastebin –