Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有子类的(Rails)对象,但是当我使用 Thinking Sphinx 时,我只想搜索该父对象,并排除搜索子类。我正在为 Rails 使用典型的 STI 设置,并在父对象上定义了 :type 列。
弄清楚了。在父对象上定义索引时,请设置以下内容:
define index do
where "parentObjects.type is null"
end
parentObjects 是父对象的表名。