竹子开花的时 发表于 2016-12-15 06:23:12

solr 空间索引的建立

solr 空间索引的建立


配置:
   
修改    schema.xml:

1、添加空间索引字段类型
   <!-- An alternative geospatial field type new to Solr 4.It supports multiValued and polygon shapes.
      For more information about this and other Spatial fields new to Solr 4, see:
      http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
    -->
    <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
               distErrPct="0.025"
               maxDistErr="0.000009"
               units="degrees"
   geo="true"/>
2、 添加空间索引字段
   <field name="LOCATION"type="location_rpt"indexed="true" stored="true"multiValued="true" />

3、数据准备:
    文者是通过csv 文件进行导入,在文件中会有一个字段LOCATION,
    数据格式为lng lat例如:116.406174 39.920142
    中间用空格隔开。


4、csv 文件的导入,并且创建索引。
    http://localhost/solr-4.1.0/update/csv?stream.file=D:\tomcat7\0102.csv&stream.contentType=text/plain;charset=utf-8





http://localhost/solr-4.1.0/update/csv?commit=true
页: [1]
查看完整版本: solr 空间索引的建立