[ 
https://issues.apache.org/jira/browse/SOLR-773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920272#action_12920272
 ] 

Bill Bell commented on SOLR-773:
--------------------------------

PB and SR:

http://<host>:8983/solr/core0/select?fl=*,score&qf=namesearch&pf=namesearch&start=0&rows=10&q=bill&qt=standard&pt=39.7391536,-104.9847034&d=160.9344&fq={!sfilt%20fl=store_lat_lon}&sort=hsin(6371,true,store,vector(39.7391536,-104.9847034))+asc,+score+desc
 

This is an example, that queries the index and returns those points 100 miles 
(160.93km) away from Denver, CO (39.7391536,-104.9847034).

It also does a dismax query on namesearch for "bill".

It sorts the results by distance in km. To show the distance use a Javascript 
hsin() function when you loop through your results.

i.e.:
{code}
        function toRad(val) {
                return (Math.PI*val/180);
        };
 
 
        function hsin(lat1,lon1,lat2,lon2) {
 
                var R = 3958.761; //miles
                var dLat = toRad(lat2-lat1);
                var dLon = toRad(lon2-lon1); 
                var a = Math.sin(dLat/2) * Math.sin(dLat/2) +        
                        Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *         
                        Math.sin(dLon/2) * Math.sin(dLon/2); 
                var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
                var d = R * c;
                return d;
        };
{code}




> Incorporate Local Lucene/Solr
> -----------------------------
>
>                 Key: SOLR-773
>                 URL: https://issues.apache.org/jira/browse/SOLR-773
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: Next
>
>         Attachments: exampleSpatial.zip, lucene-spatial-2.9-dev.jar, 
> lucene.tar.gz, screenshot-1.jpg, SOLR-773-local-lucene.patch, 
> SOLR-773-local-lucene.patch, SOLR-773-local-lucene.patch, 
> SOLR-773-local-lucene.patch, SOLR-773-local-lucene.patch, 
> SOLR-773-spatial_solr.patch, SOLR-773.patch, SOLR-773.patch, 
> solrGeoQuery.tar, spatial-solr.tar.gz
>
>
> Local Lucene has been donated to the Lucene project.  It has some Solr 
> components, but we should evaluate how best to incorporate it into Solr.
> See http://lucene.markmail.org/message/orzro22sqdj3wows?q=LocalLucene

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to