http://wiki.apache.org/solr/SpatialSearch
有三点:
1. geofilt 一个点和距离 , 指定查询字段。返回数据
...&q=*:*&fq={!geofilt sfield=store}&pt=45.15,-93.85&d=5
...&q=*:*&fq={!geofilt}&sfield=store&pt=45.15,-93.85&d=5
2.bbox 一个半径为d 边框范围,
...&q=*:*&fq={!bbox}&sfield=store&pt=45.15,-93.85&d=5
3.geodist 排序方法。默认按照距离排序,还有比较复杂的用法没有研究,注意:
?q=*&fq={!geofilt%20sfield=baidu_geo}&pt=45.15,-93.85&d=5&sort=geodist()%20asc 这是错的,会报 sort param could not be parsed as a query, and is not a field that exists in the index: geodist()
?q=*&fq={!geofilt}&sfield=baidu_geo&pt=30.648694,104.091852&d=5&sort=geodist()%20asc 这是对的
Example
<fieldType name="latLon" class="solr.LatLonType" subFieldSuffix="_latLon"/>
...
<field name="store_lat_lon" type="latLon" indexed="true" stored="true"/>
...
<dynamicField name="*_latLon" type="double" indexed="true" stored="false" multiValued="true"/>
The LatLonType is the current default spatial field. Values for this type are of the form latitude,longitude, although behind the scenes, the latitude and longitude are indexed as separate numbers. Fields using LatLonType must be single valued (i.e. multiValued="false"). This field type does distance calculations based on Great Circle (haversine).
In addition to geofilt, geodist and bbox, the LatLonType supports field queries such as field:10,20 and range queries such as field:[10,20 TO 30,40].
正确的 schema.xml 配置是:
<fieldtype name="latLon" class="solr.LatLonType"/>
<field name="geo" type="latLon" stored="true" indexed="true"/>
<dynamicField name="*_latLon" type="double" indexed="true" stored="false" multiValued="false"/>
坐标系转换
因为中国法律规定, 原始gps地图坐标不能得到, 而 goods,baidu, sogo 的参考坐标系各不相同。我存的是百度坐标系。数据库和索引里可支持多种坐标系。
分享到:
相关推荐
lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用
lucene和solr笔记
Apache Solr是使用Java编写并使用Apache Lucene的企业搜索平台。 主要功能包括全文搜索,索引复制和分片以及结果分面和突出显示。 在线文件 该自述文件仅包含基本的安装说明。 有关更全面的文档,请访问: Lucene...
lucene&solr原理分析,lucene搜索引擎和solr搜索服务器原理分析。
搜索引擎核心技术和实现是基于Lucene和Solr实现的一本书,该书详细讲解了搜索引擎的实现原来和当前最新的互联网行业应用架构,很实用。
http://archive.apache.org/dist/lucene/java/ 这个是lucene的历史版本 http://archive.apache.org/dist/lucene/solr/ 这个是solr的历史版本
lucene-solr-sandbox:Apache Lucene和Solr开源搜索软件插件模块沙箱
Apache Solr lucene 搜索模块设计实现 Solr 模块 架构 lucene 搜索
Lucene Solr 搜索引擎解密 ppt
Solr Elasticsearch lucene 搜索引擎
lucene solr 全文搜索框架,该教程有助于深入了解lucene solr的用法以及他么们之间的比较
搜索引擎核心技术与实现(基于Lucene和Solr).pdf
本人用ant idea命令花了214分钟,35秒编译的lucene-solr源码,可以用idea打开,把项目放在D:\space\study\java\lucene-solr路径下,再用idea打开就行了
Apache Lucene / Solr(和其他 )邮件列表上的土耳其用户正在增加。 该项目利用公共可用的土耳其语NLP工具从中创建。 我创建这个项目是为了促进和支持开源。 库存Lucene / Solr具有土耳其语的 。 但是,该词干提取...
Lucene全文检索框架+Solr搜索引擎(2018版.Java)Lucene实战应用
涵盖了所有官方推荐的书籍,所有书籍都基于Lucene 3以上 包括: Lucene in Action第2版 Apache Solr 3.1 Cook Book Apache Solr 3 Enterprise Search Server
公司培训讲义:搜索引擎解密Lucene与Solr的前世今生
关于solr和lucene的使用方法,这是传智播客黑马的教学视频
lucene4 solr4j arIk4
Lucene&solr简介及使用,首先介绍了lucene,之后介绍了solr,中间有各种相关插件的应用.