is there way index type of sti model (a polymorphic model's association in ruby) , not itself? example, have model comment
:
class comment < activerecord::base belongs_to :commenter, polymorphic: true ... end
is possible sphinx index commenters
, not comments
?
to specific, instead of sphinx.conf
looking like
source comment_core_0 { ... sql_query = select sql_no_cache comments.id * 60 + 2 id, 'comment' sphinx_internal_class_name, comments.id sphinx_internal_id, 'comment' sphinx_internal_class ... }
i want sphinx.conf
like:
source comment_core_0 { ... sql_query = select sql_no_cache comments.commenter_id * 60 + 2 id, commenter_type sphinx_internal_class_name, comments.commenter_id sphinx_internal_id, commenter_type sphinx_internal_class ... }
thanks
i'm afraid isn't possible thinking sphinx - built expect index maps single model. also, in situation you've described (if make work in sphinx directly, rather ts), end duplicate records if commenter has more 1 comment.
you'd better have indices each commenter type , search across of these indices @ once.
Comments
Post a Comment