更新时间:2023-02-09 21:37:09
索引数据时是否会出现任何错误?
Do you get any errors when indexing the data ??
以下数据配置正常,因为您有两个不相关的项目。
The following data config is fine as you have two unrelated items.
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/lc" user="root" password=""/>
<document name="content">
<entity name="stock" query="select ST_StockID,ST_StockCode,ST_Name,ST_ItemDetail from stock where estatus = 'Active' limit 100">
<field column="ST_StockID" name="stock_ST_StockID" />
<field column="ST_StockCode" name="stock_ST_StockCode" />
<field column="ST_Name" name="stock_ST_Name" />
<field column="ST_ItemDetail" name="stock_ST_ItemDetail" />
</entity>
<entity name="auction" query="select iauctionid,rad_number,vsku,auction_code from auction limit 100">
<field column="iauctionid" name="auction_iauctionid" />
<field column="rad_number" name="auction_rad_number" />
<field column="vsku" name="auction_vsku" />
<field column="auction_code" name="auction_auction_code" />
</entity>
</document>
</dataConfig>
然而,缺少一些东西?
However, there are few things missing ?
id
字段是什么?由于每个文档都应具有唯一的ID,因此上面的配置似乎缺失。 id
对于entites而言应该是unqiue,否则股票和拍卖应该相互覆盖。id
field for the entity ? As each document should have a unique id, the configuration seems missing above.id
should be unqiue for the entites, else the stock and auction should overwrite each other.用于分配ID -
您可以使用以下内容创建id值 - 这应该将Stock_附加到ST_StockID字段值。
You can use the following to create the id value - This should append the Stock_ with the ST_StockID field value.
<field column="id" template="Stock_#${stock.ST_StockID}" />
OR
在sql中使用别名,例如选择'Stock_'|| ST_StockID作为ID
.....作为使用 -
Use alias in sql e.g. SELECT 'Stock_' || ST_StockID AS ID
..... as use -
<field column="id" name="id" />