我使用数据导入处理程序索引了一个表(obs),而且everty认为很好。
但是当我尝试添加另一个实体并索引表(表单)时,没有任何内容被索引,甚至是obs表。
我的data-config.xml:
<document>
<entity name="obs"
query="SELECT o.uuid as id, obs_id, person_id, obs_datetime, obs_group_id, cn1.name as concept_name,
cn2.name as coded, value_boolean, value_datetime, value_numeric, value_text
FROM openmrs.obs o
inner join (SELECT * FROM openmrs.concept_name c WHERE c.locale = 'en' AND concept_name_type = 'FULLY_SPECIFIED') as cn1 on cn1.concept_id = o.concept_id
LEFT join (SELECT * FROM openmrs.concept_name c WHERE c.locale = 'en' AND concept_name_type = 'FULLY_SPECIFIED') as cn2 on cn2.concept_id = o.value_coded
WHERE person_id='${dataimporter.request.personId}' AND o.voided=0 AND cn1.voided=0"
deltaImportQuery="SELECT o.uuid as id, obs_id, person_id, obs_datetime, obs_group_id, cn1.name as concept_name,
cn2.name as coded, value_boolean, value_datetime, value_numeric, value_text
FROM openmrs.obs o
inner join (SELECT * FROM openmrs.concept_name c WHERE c.locale = 'en' AND concept_name_type = 'FULLY_SPECIFIED') as cn1 on cn1.concept_id = o.concept_id
LEFT join (SELECT * FROM openmrs.concept_name c WHERE c.locale = 'en' AND concept_name_type = 'FULLY_SPECIFIED') as cn2 on cn2.concept_id = o.value_coded
WHERE o.uuid='${dih.delta.id}' AND o.voided=0 AND cn1.voided=0"
deltaQuery="select o.uuid as id from openmrs.obs o
inner join concept_name cn on cn.concept_id = o.concept_id
where person_id='${dataimporter.request.personId}'
AND o.voided=0 AND cn.voided=0
AND o.date_created > '${dataimporter.request.lastIndexTime}'"
deletedPkQuery="select o.uuid as id from openmrs.obs o
inner join concept_name cn on cn.concept_id = o.concept_id
where person_id='${dataimporter.request.personId}'
AND (o.voided=1 OR cn.voided=1) AND o.date_voided > '${dataimporter.request.lastIndexTime}'"
>
</entity>
<entity name="forms"
query="SELECT f.uuid as form_uuid, form_id, f.name as form_name, date_created, et.name as encounter_type_name
FROM openmrs.form f
INNER JOIN openmrs.encounter_type et ON et.encounter_type_id = f.encounter_type
WHERE f.retired = 0"
deltaImportQuery="SELECT f.uuid as form_uuid, form_id, f.name as form_name, date_created, et.name as encounter_type_name
FROM openmrs.form f
INNER JOIN openmrs.encounter_type et ON et.encounter_type_id = f.encounter_type
WHERE f.uuid='${dih.delta.id}' AND f.retired = 0"
deltaQuery="select f.uuid as form_uuid from openmrs.form f
INNER JOIN openmrs.encounter_type et ON et.encounter_type_id = f.encounter_type
where f.retired = 0
AND f.date_created > '${dataimporter.request.lastIndexTime}'"
deletedPkQuery="select f.uuid as form_uuid from openmrs.form f
INNER JOIN openmrs.encounter_type et ON et.encounter_type_id = f.encounter_type
where f.retired = 0
AND f.date_voided > '${dataimporter.request.lastIndexTime}'"
>
</entity>
</document>
schema.xml中:
<field name="id" type="string" indexed="true" stored="true"
required="true" />
<field name="meta" type="boolean" indexed="true" stored="false"
required="false" />
<field name="obs_id" type="int" indexed="true" stored="true"
required="false" />
<field name="person_id" type="int" indexed="true" stored="true"
required="false" />
<field name="concept_name" type="string" indexed="true" stored="true"
required="false" />
<field name="obs_datetime" type="date" indexed="true" stored="true"
required="false" />
<field name="value_boolean" type="text_general" indexed="true"
stored="false" required="false" />
<field name="value_datetime" type="text_general" indexed="true" stored="false"
required="false" />
<field name="obs_group_id" type="int" indexed="true" stored="true"
required="false" />
<field name="value_numeric" type="text_general" indexed="true" stored="false"
required="false" />
<field name="coded" type="string" indexed="true" stored="false"
required="false" />
<field name="value_text" type="text_general" indexed="true"
stored="false" required="false" />
<field name="form_uuid" type="string" indexed="true" stored="true"
required="false" />
<field name="form_id" type="int" indexed="true" stored="true"
required="false" />
<field name="form_name" type="text_general" indexed="true" stored="true"
required="false" />
<field name="encounter_type_name" type="text_general" indexed="true" stored="true"
required="false" />
<field name="date_created" type="date" indexed="true" stored="true"
required="false" />
有人知道问题是什么吗?查询很好。
我正在使用solrj版本4.3.1。
感谢。
答案 0 :(得分:1)
看起来像&#34; obs&#34;正在工作,因为您使用的是唯一键:
o.uuid as id
你也需要这样的表格。可能:
f.something as id
如果没有id键,您的文档将被忽略,因为@Zouzias提到了