gpt4 book ai didi

ruby-on-rails - Thinking Sphinx 索引方法之间的区别

转载 作者:行者123 更新时间:2023-12-04 07:33:16 29 4
gpt4 key购买 nike

想知道它们之间有什么区别:

indexes shop.created_at, :as =>created_at
has shop(:created_at), :as => :created_at
has shop.created_at, :as => :created_at

谢谢。

最佳答案

所以我认为第 2 和第 3 之间没有区别(如果我错了请纠正我!)但是,我确信第 1 和第 2 之间有区别

indexes 用于指定字段 - 根据 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.

关于ruby-on-rails - Thinking Sphinx 索引方法之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4698573/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com