Rails gem oracle-enhanced のドキュメントで、これが複数のテーブルにインデックスを作成することを発見しました:
add_context_index :posts,
[:title, :body,
"SELECT comments.author AS comment_author, comments.body AS comment_body FROM comments WHERE comments.post_id = :id"
],
:name => 'post_and_comments_index',
:index_column => :all_text,
:index_column_trigger_on => [:updated_at, :comments_count],
:sync => 'ON COMMIT'
これは、投稿に多くのコメントがある場合に機能します。しかし、投稿に 1 つのコメント (belongs_to) しかない場合、これをどのように記述すればよいでしょうか? または、has_many トラフ関係はどうですか?
ご協力いただきありがとうございます。
-e- 私がしたことを試すためだけに
add_context_index :posts, [:title, :body]
そして、この例外を得ました:
NativeException: java.sql.SQLException: ORA-06550: line 2, column 13:
PLS-00201: identifier 'CTX_DDL' must be declared