需要使用Solr查询搜索来代替MySQL语句,但是效果不好。
当前的MYSQL表
表1-文件
字段:DOCUMENT_ID,USER_ID,DEVICE_NAME,JOB_TYPE,PAGE_COUNT
表2-DOC_GROUP
字段:DOCUMENT_ID,GROUP_ID
MySQL原始语句
SELECT DATE(CREATED_DATE) AS DateOnly, USER_ID, DEVICE_NAME, JOB_TYPE, GROUP_ID, SUM(PAGE_COUNT) AS COUNTER,COUNT(T1.DOCUMENT_ID) AS DOC_COUNT
FROM DOCUMENTS T1 inner join DOC_GROUP T2
WHERE CREATED_DATE >='2011-01-01 00:00:00' and CREATED_DATE <='2019-12-31 00:00:00'
AND USER_ID='40001'
AND DEVICE_NAME='DEVICE_A'
AND T2.GROUP='GROUP_A'
GROUP BY DateOnly, USER_ID, DEVICE_NAME, JOB_TYPE, T2.GROUP_ID
最后,尝试按以下方法进行Solr查询,但仍无法返回与MySQL返回的数据相同的结果:
Solr的预期结果包括以下数据,并且可以分组为
Current MySQL results field sample
非常感谢。