为了显示一个目录,我正在搜索以获取各种模型中的大量项目,所有这些项目都以这样的特定字母开头
@everything = ThinkingSphinx.search(
"@name ^?",
@letter,
:match_mode => :extended,
:classes => [Performer, Promoter, Tour, Venue, User],
:order => :name_sort,
:sort_mode => :asc
)
但是,这些项目不按字母顺序排序。如果我将 asc 更改为 desc,则顺序会更改,但仍无法识别。
索引是这样设置的
performer.rb
define_index do
indexes name, :sortable => true
indexes description
has created_at, updated_at
end
promoter.rb
define_index do
indexes name, :sortable => true
indexes description
has created_at, updated_at
end
tour.rb
define_index do
indexes name, :sortable => true
indexes description
has created_at, updated_at
end
venue.rb
define_index do
indexes name, :sortable => true
indexes description
has created_at, updated_at
end
user.rb
define_index do
indexes first_name, :sortable => true
indexes last_name, :as => :name, :sortable => true
indexes bio
has role, created_at, updated_at
end
如您所见,用户索引别名 last_name 作为名称,但这是唯一的奇怪之处。
我正在使用思考狮身人面像 2.0.12