Ruby on Rails中,如何比较不同Sphinx索引方法的优缺点?
- 内容介绍
- 文章标签
- 相关推荐
本文共计366个文字,预计阅读时间需要2分钟。
想要了解这些字段之间的区别:`shop.created_at`,`:as=created_at`,`:as=:created_at`。
首先,`shop.created_at` 是一个字段名,表示店铺创建的时间。
`:as=created_at` 是一个别名,用于将 `shop.created_at` 字段重命名为 `created_at`。
`:as=:created_at` 实际上与 `:as=created_at` 是一样的,都是将 `shop.created_at` 重命名为 `created_at`。
所以,这三者之间的区别很小,主要是表达方式不同。感谢提问!
想知道这些之间有什么区别:indexes shop.created_at, :as =>created_at has shop(:created_at), :as => :created_at has shop.created_at, :as => :created_at
谢谢.
所以我不认为第二和第三之间存在差异(如果我错了,请纠正我!)但是,我确信第1和第2之间的区别索引用于指定字段 – 根据Thinking Sphinx网站:
Fields are the content for your search queries – so if you want words tied to a specific document, you better make sure they’re in a field in your index. They are only string data – you could have numbers and dates and such in your fields, but Sphinx will only treat them as strings, nothing else.
has用于指定属性 – 再次,根据Thinking Sphinx网站:
Attributes are used for sorting, filtering and grouping your search results. Their values do not get paid any attention by Sphinx for search terms, though, and they’re limited to the following data types: integers, floats, datetimes (as Unix timestamps – and thus integers anyway), booleans, and strings. Take note that string attributes are converted to ordinal integers, which is especially useful for sorting, but not much else.
本文共计366个文字,预计阅读时间需要2分钟。
想要了解这些字段之间的区别:`shop.created_at`,`:as=created_at`,`:as=:created_at`。
首先,`shop.created_at` 是一个字段名,表示店铺创建的时间。
`:as=created_at` 是一个别名,用于将 `shop.created_at` 字段重命名为 `created_at`。
`:as=:created_at` 实际上与 `:as=created_at` 是一样的,都是将 `shop.created_at` 重命名为 `created_at`。
所以,这三者之间的区别很小,主要是表达方式不同。感谢提问!
想知道这些之间有什么区别:indexes shop.created_at, :as =>created_at has shop(:created_at), :as => :created_at has shop.created_at, :as => :created_at
谢谢.
所以我不认为第二和第三之间存在差异(如果我错了,请纠正我!)但是,我确信第1和第2之间的区别索引用于指定字段 – 根据Thinking Sphinx网站:
Fields are the content for your search queries – so if you want words tied to a specific document, you better make sure they’re in a field in your index. They are only string data – you could have numbers and dates and such in your fields, but Sphinx will only treat them as strings, nothing else.
has用于指定属性 – 再次,根据Thinking Sphinx网站:
Attributes are used for sorting, filtering and grouping your search results. Their values do not get paid any attention by Sphinx for search terms, though, and they’re limited to the following data types: integers, floats, datetimes (as Unix timestamps – and thus integers anyway), booleans, and strings. Take note that string attributes are converted to ordinal integers, which is especially useful for sorting, but not much else.

