1

このsolr wikiの例を使用して、データベースをモデル化しようとしています。

item というテーブルと、id、featureName、description を持つ features というテーブルがあります。

これが更新されたxmlです(featureNameが追加されました)

<dataConfig>
<dataSource driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:/temp/example/ex" user="sa" />
<document>
    <entity name="item" query="select * from item">
        <entity name="feature" query="select description, featureName as features from feature where item_id='${item.ID}'"/>
    </entity>
</document>

今、xml 要素に 2 つのリストを取得します

<doc>
 <arr name="featureName">
  <str>number of miles in every direction the universal cataclysm  was  gathering</str>
  <str>All around the Restaurant people and things relaxed and chatted.  The</str>
  <str>- Do we have... - he put up a hand to hold back the cheers, -  Do  we</str>
 </arr>
 <arr name="description">
  <str>to a stupefying climax. Glancing at his watch, Max returned to  the  stage</str>
  <str>air was filled with talk of this and that, and with the mingled scents  of</str>
  <str>have a party here from  the  Zansellquasure  Flamarion  Bridge  Club  from</str> 
 </arr>
</doc>

しかし、値を結合する必要がないように、(xml 属性を使用して) リストを一緒に表示したいと思います。
出来ますか?

4

1 に答える 1

1

ScriptTransformerを提案したかったのですが、必要に応じてデータを柔軟に変更できますが、行レベルで機能しているため、この場合は機能しません。

SQL で文字列を連結するための集計関数をいつでも定義できますが ( example )、パフォーマンスの問題が発生する可能性があります。

http/xmlデータ ソースを使用する場合、解決策は属性を使用することflattenでした。

それでも、多値フィールドになってしまった場合でも、検索機能は期待どおりに機能します。マイナス面は、プレゼンテーション層の前にそれらを連結するクライアントにありますが、何らかのページネーションを使用する場合、これは実際には問題になりません。

于 2013-06-22T23:29:50.830 に答える