这是我的searchkick用户模型配置。
# frozen_string_literal: true
class User < ApplicationRecord
# ..
searchkick word_start: [:company_name],
callbacks: :async,
filterable: %i[id role bidded_to_projects],
searchable: [:company_name]
has_many :projects
has_many :bids, foreign_key: :contractor_id
def search_data
{
company_name: company_name,
role: present_role,
id: id,
bidded_to_projects: bidded_to_projects
}
end
def bidded_to_projects
bids.joins(:project).select('projects.id').map(&:id)
end
class << self
def fetch_contractors_to_invite(project_id:, sender_id:, search_text:)
users_invited_by_current_user =
User
.joins(:received_invitations)
.where('projects_invites.project_id = ? AND projects_invites.sender_id = ?',
project_id,
sender_id)
.pluck('users.id')
User.search(
search_text,
fields: [:company_name],
where: {
role: User::CONTRACTOR,
id: { not: users_invited_by_current_user },
bidded_to_projects: { not: project_id }
},
match: :word_start,
includes: [:company_profile]
)
end
end
当我试图索引它得到如下错误。
irb(main):002:0> User.reindex
Traceback (most recent call last):
1: from (irb):2
Elasticsearch::Transport::Transport::Errors::BadRequest ([400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The [standard] token filter has been removed."}],"type":"illegal_argument_exception","reason":"The [standard] token filter has been removed."},"status":400})
irb(main):003:0>
我的代码中有什么错误导致了这个错误的发生?
1条答案
按热度按时间3bygqnnd1#
正如官方的es标准令牌过滤器参考中提到的,它已被弃用并从es 7.x中删除