Rails Algolia 404 指数不存在
Rails Algolia 404 Index Does Not Exist
我正尝试按照他们的说明使用以下代码在 Rails 4 应用程序中设置 Algolia。
algoliasearch.rb
:
AlgoliaSearch.configuration = { application_id: "my_id", api_key: "my_api" }
和
job.rb
:
class Job < ActiveRecord::Base
include AlgoliaSearch
algoliasearch do
attribute :title
end
belongs_to :user
has_many :comments
validates :title, :description, :company, :url, :logo, presence: true
end
使用这些设置,我可以很好地连接到 Algolia,但是当我在 rails 控制台中调用 Job.reindex
时,出现以下错误:
2.2.0 :002 > Job.reindex
[algoliasearch-rails] Cannot GET to https://my_id-dsn.algolia.net/1/indexes/Job.tmp/settings?getVersion=2: {"message":"Index does not exist","status":404} (404)
Job Load (0.7ms) SELECT "jobs".* FROM "jobs" ORDER BY "jobs"."id" ASC LIMIT 1000
=> nil
数据库中有示例作业,当我查看我的 Algolia 仪表板时,我可以看到记录已上传,所以不确定从这里去哪里。
因为你没有@raise_on_error
为真,你可以把它当作一个日志。有an issue about this on GitHub.
Yeah, that's actually a side-effect of the logging mechanism; we call get_settings on this non-existing-yet temporary index; I fixed it yesterday in 52a19a8; will be part of the next release.
我正尝试按照他们的说明使用以下代码在 Rails 4 应用程序中设置 Algolia。
algoliasearch.rb
:
AlgoliaSearch.configuration = { application_id: "my_id", api_key: "my_api" }
和
job.rb
:
class Job < ActiveRecord::Base
include AlgoliaSearch
algoliasearch do
attribute :title
end
belongs_to :user
has_many :comments
validates :title, :description, :company, :url, :logo, presence: true
end
使用这些设置,我可以很好地连接到 Algolia,但是当我在 rails 控制台中调用 Job.reindex
时,出现以下错误:
2.2.0 :002 > Job.reindex
[algoliasearch-rails] Cannot GET to https://my_id-dsn.algolia.net/1/indexes/Job.tmp/settings?getVersion=2: {"message":"Index does not exist","status":404} (404)
Job Load (0.7ms) SELECT "jobs".* FROM "jobs" ORDER BY "jobs"."id" ASC LIMIT 1000
=> nil
数据库中有示例作业,当我查看我的 Algolia 仪表板时,我可以看到记录已上传,所以不确定从这里去哪里。
因为你没有@raise_on_error
为真,你可以把它当作一个日志。有an issue about this on GitHub.
Yeah, that's actually a side-effect of the logging mechanism; we call get_settings on this non-existing-yet temporary index; I fixed it yesterday in 52a19a8; will be part of the next release.