如何设置实时索引属性类型
how to set realtime index attribute type
我有一个索引,我想用实时索引插入、更新和删除行,但是 index_rt 错误。
这是一个普通的索引配置:
index jobResumeIndex
{
source = jobResumeSource
path = {{path_to_data}}/{{data_file_name}}/jobResumeIndex
morphology = stem_enru
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+0435, U+451->U+0435
min_prefix_len = 3
#min_infix_len = 3
index_exact_words = 1
expand_keywords = 1
}
而且是实时配置:
index jobResumeRT
{
type = rt
source = jobResumeSource
path = {{path_to_data}}/{{data_file_name}}/jobResume
#Список полей для записи
rt_field = post
rt_field = wage
rt_field = currency_id
rt_field = tariff_rate_id
rt_field = business_trip_id
rt_field = work_experience_id
rt_field = citizenship_id
rt_field = geo_place_id
rt_field = age
rt_field = gender
rt_field = only_with_avatar
rt_field = only_with_portfolio
rt_field = only_with_wage
rt_field = visible
rt_field = status
rt_field = updated_at
rt_field = about_me
rt_field = fio
rt_field = work_permit_ids
rt_field = prof_area_ids
rt_field = driver_license_ids
rt_field = skills
rt_field = employment_ids
rt_field = schedule_ids
rt_field = education_ids
rt_field = contacts
rt_field = language_codes
rt_field = experience_text
rt_field = portfolio_text
rt_field = course_text
rt_attr_string = post
rt_attr_uint = wage
rt_attr_uint = currency_id
rt_attr_uint = tariff_rate_id
rt_attr_uint = business_trip_id
rt_attr_uint = work_experience_id
rt_attr_uint = citizenship_id
rt_attr_uint = geo_place_id
rt_attr_uint = age
rt_attr_uint = gender
rt_attr_uint = only_with_avatar
rt_attr_uint = only_with_portfolio
rt_attr_uint = only_with_wage
rt_attr_uint = visible
rt_attr_uint = status
rt_attr_uint = updated_at
rt_attr_string = about_me
rt_attr_string = fio
rt_attr_string = work_permit_ids
rt_attr_string = prof_area_ids
rt_attr_string = driver_license_ids
rt_attr_string = skills
rt_attr_string = employment_ids
rt_attr_string = schedule_ids
rt_attr_string = education_ids
rt_attr_string = contacts
rt_attr_string = language_codes
rt_attr_string = experience_text
rt_attr_string = portfolio_text
rt_attr_string = course_text
rt_mem_limit = 512M
morphology = stem_enru
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+0435, U+451->U+0435
min_prefix_len = 3
index_exact_words = 1
expand_keywords = 1
}
这里将两个索引合二为一:
index jobResume
{
type = distributed
local = jobResumeIndex
local = jobResumeRT
}
然后当我尝试插入新记录时:
mysql> insert into jobResumeRT values(119,'Инженер - инспектор по безопасности полетов',0,190,193,7,15,0,538560,'14',1,1,0,0,1,2,'1575616137','','Иван Иванов ','','12,211','','{1057369: PHP (PHP4, PHP5, PHP5.5, HPHP)}','1','10','1234567898','','','','','');
ERROR 1064 (42000): row 1, column 3: string expected
第三个字段currency_id必须是整数类型,为什么要字符串?不懂(
首先,RT 索引没有 'source'。它们直接包含数据,而不是从远程源加载。指定 source=
可能不是错误,但会被忽略
RT 索引从 rt_field
和 rt_attr_*
指令创建它们的模式。
因此,架构 不会 与 local/disk 索引相同。通常与索引定义中定义的顺序相同,但可能会有所不同(如果索引经过编辑)
...最好运行一个DESCRIBE jobResumeRT
来找到索引中所有列的实际顺序。然后在不命名列的情况下执行 INSERT
等操作时,按照从 DESCRIBE 返回的 相同 顺序插入列。
或者通过在命令中以相同的顺序命名列来执行插入。这实际上可能更好,因为可以立即插入到字符串属性和字段中。
我有一个索引,我想用实时索引插入、更新和删除行,但是 index_rt 错误。
这是一个普通的索引配置:
index jobResumeIndex
{
source = jobResumeSource
path = {{path_to_data}}/{{data_file_name}}/jobResumeIndex
morphology = stem_enru
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+0435, U+451->U+0435
min_prefix_len = 3
#min_infix_len = 3
index_exact_words = 1
expand_keywords = 1
}
而且是实时配置:
index jobResumeRT
{
type = rt
source = jobResumeSource
path = {{path_to_data}}/{{data_file_name}}/jobResume
#Список полей для записи
rt_field = post
rt_field = wage
rt_field = currency_id
rt_field = tariff_rate_id
rt_field = business_trip_id
rt_field = work_experience_id
rt_field = citizenship_id
rt_field = geo_place_id
rt_field = age
rt_field = gender
rt_field = only_with_avatar
rt_field = only_with_portfolio
rt_field = only_with_wage
rt_field = visible
rt_field = status
rt_field = updated_at
rt_field = about_me
rt_field = fio
rt_field = work_permit_ids
rt_field = prof_area_ids
rt_field = driver_license_ids
rt_field = skills
rt_field = employment_ids
rt_field = schedule_ids
rt_field = education_ids
rt_field = contacts
rt_field = language_codes
rt_field = experience_text
rt_field = portfolio_text
rt_field = course_text
rt_attr_string = post
rt_attr_uint = wage
rt_attr_uint = currency_id
rt_attr_uint = tariff_rate_id
rt_attr_uint = business_trip_id
rt_attr_uint = work_experience_id
rt_attr_uint = citizenship_id
rt_attr_uint = geo_place_id
rt_attr_uint = age
rt_attr_uint = gender
rt_attr_uint = only_with_avatar
rt_attr_uint = only_with_portfolio
rt_attr_uint = only_with_wage
rt_attr_uint = visible
rt_attr_uint = status
rt_attr_uint = updated_at
rt_attr_string = about_me
rt_attr_string = fio
rt_attr_string = work_permit_ids
rt_attr_string = prof_area_ids
rt_attr_string = driver_license_ids
rt_attr_string = skills
rt_attr_string = employment_ids
rt_attr_string = schedule_ids
rt_attr_string = education_ids
rt_attr_string = contacts
rt_attr_string = language_codes
rt_attr_string = experience_text
rt_attr_string = portfolio_text
rt_attr_string = course_text
rt_mem_limit = 512M
morphology = stem_enru
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+0435, U+451->U+0435
min_prefix_len = 3
index_exact_words = 1
expand_keywords = 1
}
这里将两个索引合二为一:
index jobResume
{
type = distributed
local = jobResumeIndex
local = jobResumeRT
}
然后当我尝试插入新记录时:
mysql> insert into jobResumeRT values(119,'Инженер - инспектор по безопасности полетов',0,190,193,7,15,0,538560,'14',1,1,0,0,1,2,'1575616137','','Иван Иванов ','','12,211','','{1057369: PHP (PHP4, PHP5, PHP5.5, HPHP)}','1','10','1234567898','','','','','');
ERROR 1064 (42000): row 1, column 3: string expected
第三个字段currency_id必须是整数类型,为什么要字符串?不懂(
首先,RT 索引没有 'source'。它们直接包含数据,而不是从远程源加载。指定 source=
可能不是错误,但会被忽略
RT 索引从 rt_field
和 rt_attr_*
指令创建它们的模式。
因此,架构 不会 与 local/disk 索引相同。通常与索引定义中定义的顺序相同,但可能会有所不同(如果索引经过编辑)
...最好运行一个DESCRIBE jobResumeRT
来找到索引中所有列的实际顺序。然后在不命名列的情况下执行 INSERT
等操作时,按照从 DESCRIBE 返回的 相同 顺序插入列。
或者通过在命令中以相同的顺序命名列来执行插入。这实际上可能更好,因为可以立即插入到字符串属性和字段中。