Thinking Sphinx(v4.4) - 在索引定义中包含 'where' 条件后进行索引时出错
Thinking Sphinx(v4.4) - Error while indexing after including 'where' condition in index definition
思维狮身人面像gem 版本 - 4.4.1
Sphinx 版本 - 3.3.1
我明白了
ERROR: index 'article_core': no full text fields in schema, nothing to index!
在索引定义中包含 where 条件后进行索引。
索引定义如下
ThinkingSphinx::Index.define :article, :with => :active_record do
indexes title
# where "text = 'Past Simple'" # type of text column is text: rebuild successful
# where "id > 1" # type of id column is int: rebuild successful
where "photo = 'photo'" # type of photo column is String : rebuild fails
end
- 当我们在索引中使用 where 条件时出现问题
字符串列上的定义(不同的字符)
- 当我们将 where 条件应用于其他数据类型时,不会出现此问题。
- 错误语句是'错误:索引'article_core':模式中没有全文字段,没有
索引!'
我想知道您是否使用 PostgreSQL 作为您的应用程序数据库?也许您没有任何符合 where
条件的文章? Sphinx 3.x 版本存在一个问题,空索引在索引时会引发错误(似乎它在上周才发布的 v3.3.1 中没有修复)。
我已经 lodged this issue with the Sphinx team,但到目前为止还没有任何回复。
如果您真的想使用 SQL 支持的索引,恐怕您将不得不降级到 Sphinx 2.2.11,或者考虑切换到 Manticore(没有这个问题的狮身人面像)。或者,您可以改用 real-time indices,它可以很好地与 Sphinx v3 配合使用。如果是这样,您可以在索引中使用 scope
方法来限制结果:
ThinkingSphinx::Index.define :article, :with => :real_time do
indexes title
scope { Article.where(:photo => "photo") }
end
思维狮身人面像gem 版本 - 4.4.1 Sphinx 版本 - 3.3.1
我明白了
ERROR: index 'article_core': no full text fields in schema, nothing to index!
在索引定义中包含 where 条件后进行索引。
索引定义如下
ThinkingSphinx::Index.define :article, :with => :active_record do
indexes title
# where "text = 'Past Simple'" # type of text column is text: rebuild successful
# where "id > 1" # type of id column is int: rebuild successful
where "photo = 'photo'" # type of photo column is String : rebuild fails
end
- 当我们在索引中使用 where 条件时出现问题
字符串列上的定义(不同的字符) - 当我们将 where 条件应用于其他数据类型时,不会出现此问题。
- 错误语句是'错误:索引'article_core':模式中没有全文字段,没有 索引!'
我想知道您是否使用 PostgreSQL 作为您的应用程序数据库?也许您没有任何符合 where
条件的文章? Sphinx 3.x 版本存在一个问题,空索引在索引时会引发错误(似乎它在上周才发布的 v3.3.1 中没有修复)。
我已经 lodged this issue with the Sphinx team,但到目前为止还没有任何回复。
如果您真的想使用 SQL 支持的索引,恐怕您将不得不降级到 Sphinx 2.2.11,或者考虑切换到 Manticore(没有这个问题的狮身人面像)。或者,您可以改用 real-time indices,它可以很好地与 Sphinx v3 配合使用。如果是这样,您可以在索引中使用 scope
方法来限制结果:
ThinkingSphinx::Index.define :article, :with => :real_time do
indexes title
scope { Article.where(:photo => "photo") }
end