[英]PostgreSQL hstore & searching with Sphinx
我有一個Ruby on Rails 4.0應用程序,正在使用PostgreSQL數據庫管理系統。
我的schema.db如下所示:
create_table "items", force: true do |t|
t.string "title"
t.hstore "properties"
t.datetime "created_at"
t.datetime "updated_at"
end
記錄示例:
<Item id: 1, title: "CASTROL", properties: {"type"=>"oil", "cars"=>"all"}>
我可以使用Sphinx搜索PostgreSQL hstore密鑰嗎?
ThinkingSphinx::Index.define :item, :with => :active_record do
# fields
indexes title, :sortable => true
indexes "properties -> 'cars'", :as => :cars, :sortable => true
indexes "properties -> 'type'", :as => :type, :sortable => true
# attributes
has created_at, updated_at
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.