使用空间搜索来统计我的用户总数
Use spatial search to count the total number of my users
我正在尝试通过图片描述我的问题。
这是我的数据格式。
我想知道如何在solr中实现这样的统计?
我想用solr实现如下方式t-sql查询。
SELECT
(
SELECT
COUNT(hl_user_info_copy.location)
FROM
hl_user_info_copy
WHERE
location > 3
) AS 'where_1_count',
(
SELECT
COUNT(hl_user_info_copy.location)
FROM
hl_user_info_copy
WHERE
location > 2
AND location < 3
) AS 'where_2_count'
FROM
hl_user_info_copy
LIMIT 1
t-sql查询结果:
where_1_count where_2_count
4832 4560
我已经解决了这个问题并分享了我的代码。
我正在尝试通过图片描述我的问题。
这是我的数据格式。
我想知道如何在solr中实现这样的统计?
我想用solr实现如下方式t-sql查询。
SELECT
(
SELECT
COUNT(hl_user_info_copy.location)
FROM
hl_user_info_copy
WHERE
location > 3
) AS 'where_1_count',
(
SELECT
COUNT(hl_user_info_copy.location)
FROM
hl_user_info_copy
WHERE
location > 2
AND location < 3
) AS 'where_2_count'
FROM
hl_user_info_copy
LIMIT 1
t-sql查询结果:
where_1_count where_2_count
4832 4560
我已经解决了这个问题并分享了我的代码。