首页 > sphinx/coreseek 怎么做位置搜索

sphinx/coreseek 怎么做位置搜索

配置文件如下

    sql_query = select id, id as restaurant_id, restaurant_name as name, phone, price,  \
        city_id, address, IF(`longitude`,`longitude`,0.0) as longitude, IF(`latitude`, `latitude`, 0.0) as latitude \
        from `...` \
    ...
    ...
        sql_attr_float     = longitude
        sql_attr_float     = latitude

执行结果如下:

mysql> SELECT *,GEODIST(31.22650528,121.49153900,latitude,longitude) as distance FROM `restaurant_index` WHERE distance < 10000 ORDER BY `id` ASC LIMIT 0, 10 \G
ERROR 1064 (42000): index restaurant_index: unsupported filter type 'intrange' on float column

版本:Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)]

哪里不对呢? 或者说sphinx做位置搜索应该怎么做.


问题作废,貌似是版本的问题.
我用原生的sphinx 2.2.8测试了一把, 不报错.
顺便问下,coreseek是不是停止开发了? 那么现在的中文全文检索用什么?

Server version: 2.2.8-id64-release (rel22-r4942)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT *,GEODIST(31.22650528,121.49153900,latitude,longitude) as distance FROM `restaurant_index` WHERE distance < 10000 ORDER BY `id` ASC LIMIT 0, 10 \G
Empty set (0.05 sec)

尝试了一下这么做,把<1000修改为<=1000.0 能够正常查询了.

mysql> SELECT *,GEODIST(31.22650528,121.49153900,latitude,longitude) as distance FROM `restaurant_index` WHERE distance <= 1000.0 ORDER BY `id` ASC LIMIT 0, 10 \G
*************************** 1. row ***************************
       id: 1
     name: 南翔馒头店(豫园路店)
    phone: 021-63554206
    price: 40
  city_id: 803
  address: 上海市黄浦区豫园路85号近旧校场路九曲桥旁
longitude: 121.491539
 latitude: 31.226505
 distance: 0.000000

用mysql数据量稍起来就很慢了,用mongo吧,2d索引,非常方便,效率也还好,百万级都不慢

【热门文章】
【热门文章】