0
我有一个多态关联一张纸条模型,就像下面如何基于在狮身人面像搜索
incident has one symptom -> (note model)
incident has many comments -> (note model)
和
我愿做中缀条件加缀和前缀索引嵌套模型索引与笔记型“症状”的字条,并希望做前缀索引与类型的纪录“注释”
我试过在狮身人面像索引下面的代码
ThinkingSphinx::Index.define(:incident, DEFAULT_INDEX_OPTIONS.merge(name: "incident_prefix"), &Searchable.beetilable_index('Incident', index_count: incident_index_count, index_id: i) {
set_property :min_infix_length => 3
indexes notes.note, :as => :notes, :source => :query
notes.where(note_type: "Symptom")
}
ThinkingSphinx::Index.define(:incident, DEFAULT_INDEX_OPTIONS.merge(name: "incident_infix"), &Searchable.beetilable_index('Incident', index_count: incident_index_count, index_id: i) {
set_property :min_prefix_length => 3
indexes notes.note, :as => :notes, :source => :query
notes.where.not(note_type: "Symptom")
}
上面的代码只是使用INFIX选项进行索引,而忽略了PREFIX之一。我猜我的病情有问题,有人能让我知道如何实现这一目标吗?