V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MrXiong
V2EX  ›  Java

solr 查询相关问问题

  •  
  •   MrXiong · 2017-09-15 15:26:07 +08:00 · 2395 次点击
    这是一个创建于 2658 天前的主题,其中的信息可能已经有所发展或是发生改变。

    solr 查询经纬度

    http://172.19.3.40:8998/solr/core_alias/select?q=_copy_field:{!geofilt pt=32.163793,118.703287 sfield=baidu_lat_lng d=2 score=distance}&sort=score asc&wt=json

    这样的查询语句的结果如下:

    {
        "responseHeader": {
            "status": 0,
            "QTime": 228,
            "params": {
                "sort": "score asc",
                "q": "_copy_field:{!geofilt  pt=32.163793,118.703287 sfield=baidu_lat_lng d=2 score=distance}",
                "wt": "json"
            }
        },
        "response": {
            "numFound": 15,
            "start": 0,
            "maxScore": 1.9857113,
            "docs": [
                {
                    "id": "546431",
                    "city_name": "2、玉皇庙",
                    "city_name_desc": "2、玉皇庙",
                    "province_id": 3,
                    "province_name": "山东",
                    "city_pinyin_url": "2yuhuangmiao",
                    "bus_busy_flag": "N",
                    "tourist_busy_flag": "N",
                    "hotel_busy_flag": "N",
                    "city_busy_flag": "N",
                    "parent_city_id": 481801,
                    "parent_city_name": "商河县",
                    "leve_code": 3,
                    "city_desc_pinyin": "2yuhuangmiao",
                    "city_pinyin": "2yuhuangmiao",
                    "city_pinyin_letter_all": "2YHM",
                    "city_pinyin_letter_desc": "2YHM",
                    "last_update_date": "2017-09-15T13:14:53Z",
                    "_version_": 1578581443038150658
                },
                {
                    "id": "333205",
                    "hotel_name": "南京新区别墅乐活派",
                    "hotel_address": "高新区高新别墅 13 栋",
                    "latitude_longitude": "32.163932,118.704738",
                    "minprice": "0",
                    "df_score": 0,
                    "start_id": 0,
                    "hotel_busy_flag": "N",
                    "chain_hotel_id": 0,
                    "book_day": "0",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.169932,118.711238",
                    "vendor_hotel_id": "345319",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:46",
                    "_version_": 1578581508252237824
                },
                {
                    "id": "206126",
                    "hotel_name": "汉庭酒店(南京浦口东大成贤学院店)",
                    "hotel_address": "南京市浦口高新区丽景路 1 号",
                    "latitude_longitude": "32.162963,118.719019",
                    "minprice": "189",
                    "df_score": 439,
                    "start_id": 1,
                    "hotel_busy_flag": "Y",
                    "chain_hotel_id": 5,
                    "book_day": "8",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.162963,118.719019",
                    "vendor_hotel_id": "251107",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:19",
                    "_version_": 1578581486891696129
                },
                {
                    "id": "243827",
                    "hotel_name": "南京春东旅馆",
                    "hotel_address": "近郊浦口区泰西路 18-8 号华侨绿洲花苑 110 栋 105 室",
                    "latitude_longitude": "32.154206,118.715424",
                    "minprice": "70",
                    "df_score": 0,
                    "start_id": 1,
                    "hotel_busy_flag": "Y",
                    "chain_hotel_id": 0,
                    "book_day": "10",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.154206,118.715424",
                    "vendor_hotel_id": "172009",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:46",
                    "_version_": 1578581502260674561
                },
                {
                    "id": "206273",
                    "hotel_name": "桃园宾馆(东大路店)",
                    "hotel_address": "浦口区泰山新村东大路 2 号",
                    "latitude_longitude": "32.150208,118.711454",
                    "minprice": "0",
                    "df_score": 0,
                    "start_id": 0,
                    "hotel_busy_flag": "N",
                    "chain_hotel_id": 0,
                    "book_day": "0",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.156208,118.717954",
                    "vendor_hotel_id": "212000",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:45",
                    "_version_": 1578581496306860033
                },
                {
                    "id": "207222",
                    "hotel_name": "南京金鹏达宾馆",
                    "hotel_address": "南京市浦口区宁六路 38 号(近东大路)",
                    "latitude_longitude": "32.158577,118.720071",
                    "minprice": "0",
                    "df_score": 15,
                    "start_id": 0,
                    "hotel_busy_flag": "N",
                    "chain_hotel_id": 0,
                    "book_day": "0",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.158577,118.720071",
                    "vendor_hotel_id": "39867",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:45",
                    "_version_": 1578581498291814400
                },
                {
                    "id": "206435",
                    "hotel_name": "南京零点空间宾馆",
                    "hotel_address": "浦口区宁六路 1-30 号",
                    "latitude_longitude": "32.155662,118.719814",
                    "minprice": "0",
                    "df_score": 3,
                    "start_id": 1,
                    "hotel_busy_flag": "N",
                    "chain_hotel_id": 0,
                    "book_day": "0",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.155662,118.719814",
                    "vendor_hotel_id": "176674",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:45",
                    "_version_": 1578581496738873345
                },
                {
                    "id": "333272",
                    "hotel_name": "南京弘扬连锁公寓天华硅谷一期南区",
                    "hotel_address": "南京市浦口区天华硅谷一期南区",
                    "latitude_longitude": "32.15477,118.715641",
                    "minprice": "0",
                    "df_score": 0,
                    "start_id": 0,
                    "hotel_busy_flag": "N",
                    "chain_hotel_id": 0,
                    "book_day": "0",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.16077,118.722141",
                    "vendor_hotel_id": "340017",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:46",
                    "_version_": 1578581508294180864
                },
                {
                    "id": "206643",
                    "hotel_name": "南京彭玉华精品酒店",
                    "hotel_address": "浦口区宁六路 1-27 号",
                    "latitude_longitude": "32.155309,118.719756",
                    "minprice": "0",
                    "df_score": 8,
                    "start_id": 1,
                    "hotel_busy_flag": "N",
                    "chain_hotel_id": 0,
                    "book_day": "0",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.155309,118.719756",
                    "vendor_hotel_id": "153844",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:45",
                    "_version_": 1578581497219121152
                },
                {
                    "id": "333283",
                    "hotel_name": "南京弘扬连锁公寓天华硅谷一期北区",
                    "hotel_address": "南京市浦口区天华硅谷一期北区",
                    "latitude_longitude": "32.157361,118.716333",
                    "minprice": "0",
                    "df_score": 0,
                    "start_id": 0,
                    "hotel_busy_flag": "N",
                    "chain_hotel_id": 0,
                    "book_day": "0",
                    "city_name": "南京市",
                    "city_id": "390073",
                    "baidu_lat_lng": "32.163361,118.722833",
                    "vendor_hotel_id": "339932",
                    "city_pinyin_url": "nanjingshi",
                    "city_busy_flag": "Y",
                    "have_sort": 0,
                    "last_update_date": "2017-09-15 13:15:46",
                    "_version_": 1578581512308129792
                }
            ]
        }
    }
    

    求教,为什么会把玉皇庙给查出来,怎样去除

    9 条回复    2017-09-15 22:53:26 +08:00
    MrXiong
        1
    MrXiong  
    OP
       2017-09-15 15:58:25 +08:00
    要沉了顶一下,恩
    wudanyang
        2
    wudanyang  
       2017-09-15 16:13:34 +08:00
    fq=baidu_lat_lng:*
    MrXiong
        3
    MrXiong  
    OP
       2017-09-15 17:34:53 +08:00
    @wudanyang 不行,老铁,直接报错 undefined field baidu_lat_lng
    wudanyang
        4
    wudanyang  
       2017-09-15 18:38:23 +08:00
    @MrXiong http://172.19.3.40:8998/solr/core_alias/select?q=_copy_field:{!geofilt pt=32.163793,118.703287 sfield=baidu_lat_lng d=2 score=distance}&sort=score asc&wt=json&fq=baidu_lat_lng:*
    cevincheung
        5
    cevincheung  
       2017-09-15 18:39:56 +08:00
    还是 elasticsearch 好
    fox0001
        6
    fox0001  
       2017-09-15 20:25:03 +08:00
    把没有 baidu_lat_lng 的数据过滤掉
    MrXiong
        7
    MrXiong  
    OP
       2017-09-15 22:51:12 +08:00
    @wudanyang 老铁你的这个我执行力,就是 undefined field baidu_lat_lng 错误
    MrXiong
        8
    MrXiong  
    OP
       2017-09-15 22:52:52 +08:00
    @fox0001 我不知道咋过滤,因为用的 alias,也 google 了,对于多 collection 查询先关的比较少,官方 doc 这块也少,就不知道咋解决了
    MrXiong
        9
    MrXiong  
    OP
       2017-09-15 22:53:26 +08:00
    @cevincheung es 现在确实很流行,但是没办法公司用的 solr
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5930 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 02:31 · PVG 10:31 · LAX 18:31 · JFK 21:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.