開発中のSolr4.0のSpatialSearchを試してみました。
バンドルされているサンプルデータにも緯度経度を含んだデータが入っているので簡単に試すことができます。
最新の配布パッケージをダウンロード ( ファイル名はこちらを確認してください https://hudson.apache.org/hudson/job/Solr-trunk/lastSuccessfulBuild/artifact/checkout/solr/dist/ ) % wget https://hudson.apache.org/hudson/job/Solr-trunk/lastSuccessfulBuild/artifact/checkout/solr/dist/apache-solr-4.0-2011-01-05_08-06-40.tgz % tar xvfz apache-solr-4.0-2011-01-05_08-06-40.tgz % cd apache-solr-4.0-2011-01-05_08-06-40/example Solr の起動 % java -jar start.jar サンプルデータのインデキシング % post.sh *.xml
中心地の緯度経度 45.15, -93.85 から 半径5Km以内の店舗を探すクエリ例
http://localhost:8983/solr/select?fl=name,store,score&q=*:*&fq={!geofilt%20pt=45.15,-93.85%20sfield=store%20d=5}
距離の近い順にソートして返す検索例。距離はscoreで返ってきます。単位はKmです。
http://localhost:8983/solr/select?fl=name,store,score&q={!func}geodist()&sfield=store&pt=45.15,-93.85&sort=score+asc
Solr1.5 と比べると理解しやすく、使いやすくなっていると思います。