我是solr的新手。我在db-data-config和managed-schema中的所有字段中定义了查询,但是当我运行solr时,实体中没有任何内容。
这是db-data-config文件中的sql查询。
<entity name="Ticket" pk="ID" query="SELECT DISTINCT t.component_id,
DATE(t.createddate)
AS callLogDate,
dm.dealercode,
dm.name1,
t.ticketnumber,
ibm.ibasecustomername,
ibm.contactpersonmobile1,
ibm.pincode,
ibm.city,
divm.name1_lastname
AS Division,
pgm.productgroupdescription,
pm.productname,
mm.modeldesc, mm.modelcode,
fsr.OBLIGATIONTYPE_ID,
t.problemdescription
AS ProblemDescription,
DATE(t.createddate)
AS Call_Log_Date,
TIME (t.createddate)
AS CallLoggingTime,
CONCAT(CONCAT(MONTH(t.createddate), '-'),
( YEAR(t.createddate) )) AS
CALLLOG_MMYYYY,
(SELECT Max(TDS.updatedon) AS DISPATCHED_DATE_AND_TIME
FROM serveit.ticketdetails TDS
WHERE TDS.status_id = 1001
AND t.ticket_id = tds.ticket_id),
(SELECT Min(TDS.updatedon) AS Response_Call_Date_And_Time
FROM serveit.ticketdetails TDS
WHERE TDS.status_id = 1042
AND t.ticket_id = tds.ticket_id),
(SELECT Min(TIME(TDS.updatedon)) AS Response_Call_Time
FROM serveit.ticketdetails TDS
WHERE TDS.status_id = 1042
AND t.ticket_id = tds.ticket_id),
(SELECT
Max(TDS.RESPONSE_SCHEDULED) AS Last_Response_Scheduled_Date_And_Time
FROM serveit.ticketdetails TDS
WHERE TDS.status_id = 1042
AND t.ticket_id = tds.ticket_id),
(SELECT Max(TDS.updatedon) AS Resolved_Date_And_Time
FROM serveit.ticketdetails TDS
WHERE TDS.status_id = 1009
AND t.ticket_id = tds.ticket_id),
(SELECT Max(TDS.updatedon) AS Closed_Date_And_Time
FROM serveit.ticketdetails TDS
WHERE TDS.status_id = 1014
AND t.ticket_id = tds.ticket_id),
t.tat,
fsr.fsrnumber,
fsr.technicianname,
wkm.work_type
AS Worktype_code,
(SELECT Sum(fa.amount)
FROM serveit.fsramountcollected fa
WHERE fa.fsr_id = FSR.fieldservicereport_id
GROUP BY fa.fsr_id)
AS AMOUNT,
rd.symptom,rd.DEFECT , rd.ACTIONTAKEN,
dm.name1,
dm.city
AS Location,
CONCAT(CONCAT(emp.name1, ' '), emp.name2)
AS SDE_NAME,
t.payout_rate
AS Call_Amount,
t.travel_allowance_rate
AS Travel_Amount,
( t.payout_rate + t.travel_allowance_rate )
AS Total_Amount,
cds.productserialnumber,t.CALL_TYPE_ID , fsr.MODEL_ID
FROM serveit.ticket t
INNER JOIN serveit.ticketdetails td
ON t.ticket_id = td.ticket_id
INNER JOIN serveit.dealermaster dm
ON dm.dealer_id = td.dealer_id
INNER JOIN serveit.productmaster pm
ON pm.product_id = td.product_id
INNER JOIN serveit.productgroupmaster pgm
ON pm.productgroup_id = pgm.productgroup_id
INNER JOIN serveit.divisionmaster divm
ON divm.division_id = pgm.SALESDIVISION_ID
INNER JOIN serveit.fieldservicereport fsr
ON fsr.ticket_id = t.ticket_id
INNER JOIN serveit.employeemaster emp
ON td.sde_id = emp.employee_id
INNER JOIN serveit.cdaufdetails cds
ON cds.ticket_id = t.ticket_id
INNER JOIN serveit.modelmaster mm
ON mm.MODEL_ID=fsr.MODEL_ID
INNER JOIN serveit.ibasemaster ibm
ON ibm.ibase_id = t.ibase_id
INNER JOIN (SELECT rds.FIELDSERVICEREPORT_ID, Max(rds.RESOLUTION_ID) as res_ID
FROM serveit.resolutiondetails rds group by rds.FIELDSERVICEREPORT_ID) DFSR on Dfsr.FIELDSERVICEREPORT_ID = fsr.FIELDSERVICEREPORT_ID
INNER JOIN serveit.resolutiondetails rd ON DFSR.res_ID = rd.RESOLUTION_ID
inner JOIN serveit.work_type_master wkm
ON wkm.id = t.work_type_id
WHERE t.call_type_id <> 30 and t.SCENARIONUMBER in ('1','2')
AND td.status_id = 1014;
"/>
不理解为什么实体没有在solr中显示。
答案 0 :(得分:1)
SQL Query 太多了,根本无法做任何事情。它会返回Solr以外的任何东西吗?
您是否可以尝试将该查询简化为具有单个字段的查询,并查看是否通过该地图进行映射。如果没有,那么问题可能出在架构定义中,您可以对其进行故障排除。如果是这样,那么它可能是SQL方面的问题,您需要慢慢扩展查询以查看它开始失败的位置。
或者,一旦单个字段工作,创建一个临时表,其中包含该查询的具体化结果,并首先对其进行测试。