SQLファイルからドキュメントをインポートするようにSOLRをセットアップしようとしています。私はこれをdata-configに入れるべきだと思いました:
<dataConfig>
<dataSource driver="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/wikipedia" user="wikipedia" password="secret" />
<document>
<entity name="page" query="SELECT page_id, page_title from page">
<field column="page_id" name="id" />
<field column="page_title" name="name" />
<entity name="revision" query="select rev_id from revision where rev_page=${page.page_id}">
<entity name="pagecontent" query="select old_text from pagecontent where old_id=${revision.rev_id}">
<field column="old_text" name="text" />
</entity>
</entity>
</entity>
</document>
</dataConfig>
私の場合、スキーマは次のようになります。
CREATE TABLE country (
id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255) NOT NULL
)
;
CREATE TABLE location (
id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255) NOT NULL,
coordinate varchar(255) NOT NULL,
country_id integer NOT NULL REFERENCES country (id)
)
;
CREATE TABLE item (
id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
title varchar(60) NOT NULL,
description varchar(900) NOT NULL,
date datetime NOT NULL,
source varchar(255) NOT NULL,
link varchar(255) NOT NULL,
location_id integer NOT NULL REFERENCES location (id)
)
;
次のフィールドをSolrにインポートしたい場合:
id
title
description
date
source
link
location(name)
location(co-ordinates)
誰かが私のデータを使用するようにサンプルのdata-configを変更する途中で私を助けてくれますか?私が混乱しているのは、いつ「エンティティ」を使用するか、いつ「フィールド列」を使用するかです。