solr 查询相关问问题

2017-09-15 15:26:07 +08:00
 MrXiong

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
            }
        ]
    }
}

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

2252 次点击
所在节点    Java
9 条回复
MrXiong
2017-09-15 15:58:25 +08:00
要沉了顶一下,恩
wudanyang
2017-09-15 16:13:34 +08:00
fq=baidu_lat_lng:*
MrXiong
2017-09-15 17:34:53 +08:00
@wudanyang 不行,老铁,直接报错 undefined field baidu_lat_lng
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
2017-09-15 18:39:56 +08:00
还是 elasticsearch 好
fox0001
2017-09-15 20:25:03 +08:00
把没有 baidu_lat_lng 的数据过滤掉
MrXiong
2017-09-15 22:51:12 +08:00
@wudanyang 老铁你的这个我执行力,就是 undefined field baidu_lat_lng 错误
MrXiong
2017-09-15 22:52:52 +08:00
@fox0001 我不知道咋过滤,因为用的 alias,也 google 了,对于多 collection 查询先关的比较少,官方 doc 这块也少,就不知道咋解决了
MrXiong
2017-09-15 22:53:26 +08:00
@cevincheung es 现在确实很流行,但是没办法公司用的 solr

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/390976

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX