如何限制发送到 Algolia 的记录?
How to limit what records are sent to Algolia?
在 Rails 上使用 Ruby 中的 Algolia,我可以轻松地为模型建立索引:
class Service < ActiveRecord::Base
include AlgoliaSearch
algoliasearch per_environment: true do
attributesToIndex ['name', 'canonical_url']
attributes ['name', 'canonical_url]
add_attribute :type do
"Service"
end
end
end
有什么方法可以限制我要发送的Service
?
例如:Only index Services where name != nil
绝对可以做到:
https://github.com/algolia/algoliasearch-rails#restrict-indexing-to-a-subset-of-your-data
class Service < ActiveRecord::Base
include AlgoliaSearch
algoliasearch if: :name? do
end
end
在 Rails 上使用 Ruby 中的 Algolia,我可以轻松地为模型建立索引:
class Service < ActiveRecord::Base
include AlgoliaSearch
algoliasearch per_environment: true do
attributesToIndex ['name', 'canonical_url']
attributes ['name', 'canonical_url]
add_attribute :type do
"Service"
end
end
end
有什么方法可以限制我要发送的Service
?
例如:Only index Services where name != nil
绝对可以做到: https://github.com/algolia/algoliasearch-rails#restrict-indexing-to-a-subset-of-your-data
class Service < ActiveRecord::Base
include AlgoliaSearch
algoliasearch if: :name? do
end
end