2016-12-26 82 views
0

我是solr的新手。我已經在db-data-config和託管模式中的所有字段中定義了查詢,但是當我運行solr時,Entity中沒有任何內容。實體名稱未在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中顯示。

回答

1

這太多了SQL查詢能夠做任何事情。它是否會返回Solr之外的任何內容?

你可以嘗試簡化該查詢與字段,看看是否映射通過。如果沒有,那麼問題可能出現在架構定義中,您可以對其進行故障排除。如果是這樣,那麼它可能是SQL方面的問題,你需要慢慢擴展查詢,看看它開始失敗的地方。

或者,一旦單個字段工作,創建一個具有該查詢的物化結果的臨時表並針對該查詢進行測試。

+0

實際上,在查詢的第二行有一個<>,它在solr中不受支持。在solr中不等於!=。這解決了問題.Chears –