/
README
163 lines (153 loc) · 3.56 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
Introduction
============
Cargeur is a simple CSV file loader for Hbase and Cassandra. HBase is fully supported now. Will add
Cassandra support. A JSON config file defines metadta mapping between csv and NOSQL table, column family etc.
Mapping
=======
A csv column can be mapped to one or more NOSQL db column. For mapping to mutiple columns, the installed
preLoadHandler is supposed to split a CSV column into mutiple parts. Also multipkle csv columns could be
mapped to one NOSQL db column.
Some of the coulns can be designated as part of the row key. All columns designated as part of row key
are concatanated to create NOSQL db row key.
One or more columns with constant value can be injected by passing a Map<String,String> to the API. These
data elements are designated as sideData
API
===
The load() method in the Loader class is the entry point to the API
Solr Indexing
=============
Data can optionally be indexed with Solr. All attributes with indexed flag set are indexed.
Configuration
=============
Here is a sample configuration for loading product data from csv to a HBase table while being indexed
with Solr
{
"name" : "product catalog",
"database" : "hbase",
"table" : "products",
"colNameInFirstRow" : true,
"rowKey" : ["seller", "category", "sku"],
"batchSize" : 5,
"preLoadHandler" : "org.chargeur.handler.ProductPreLoadHandler",
"indexManagerClass" : "org.chargeur.core.SolrIndexManager",
"indexServerUrl" : "http://localhost:8983/solr",
"columnMappers" :
[
{
"name" : "sku",
"ordinal" : 1,
"dataType" : "string",
"colFamily" : "main",
"col" : "sku",
"useAsRowKey" : true,
"maxSize" : 20,
"sideData" : false,
"indexed" : true
},
{
"name" : "seller",
"ordinal" : 0,
"dataType" : "string",
"colFamily" : "main",
"col" : "seller",
"useAsRowKey" : true,
"maxSize" : 30,
"sideData" : true,
"defaultValue" : "anySeller",
"indexed" : true
},
{
"name" : "model",
"ordinal" : 3,
"dataType" : "string",
"colFamily" : "main",
"col" : "model",
"useAsRowKey" : false,
"sideData" : false
},
{
"name" : "title",
"ordinal" : 4,
"dataType" : "string",
"colFamily" : "main",
"col" : "title",
"useAsRowKey" : false,
"sideData" : false,
"indexed" : true
},
{
"name" : "description",
"ordinal" : 5,
"dataType" : "string",
"colFamily" : "main",
"col" : "description",
"useAsRowKey" : false,
"sideData" : false,
"indexed" : true
},
{
"name" : "category",
"ordinal" : 4,
"dataType" : "string",
"colFamily" : "main",
"col" : "category",
"useAsRowKey" : true,
"maxSize" : 30,
"sideData" : false,
"defaultValue" : "generic",
"indexed" : true
},
{
"name" : "price",
"ordinal" : 17,
"colFamily" : "main",
"col" : "price"
},
{
"name" : "details1",
"ordinal" : 6,
"colFamily" : "other",
"col" : "details",
"manyToOne" : true,
"indexed" : true
},
{
"name" : "details2",
"ordinal" : 7,
"colFamily" : "other",
"col" : "details",
"manyToOne" : true,
"indexed" : true
},
{
"name" : "details3",
"ordinal" : 8,
"colFamily" : "other",
"col" : "details",
"manyToOne" : true,
"indexed" : true
},
{
"name" : "details4",
"ordinal" : 9,
"colFamily" : "other",
"col" : "details",
"manyToOne" : true,
"indexed" : true
},
................
{
"name" : "image1",
"ordinal" : 19,
"colFamily" : "other",
"col" : "images"
},
{
"name" : "image2",
"ordinal" : 20,
"colFamily" : "other",
"col" : "images"
},
...............
]
}