Hi Sandeep, You're probably better off asking on the LocalSolr mailing list (I think there is one) or trying out the Solr trunk, which has much of this functionality incorporated in a more native manner. For docs on that, refer to http://wiki.apache.org/solr/SpatialSearch, but note it is not yet complete.
-Grant On Apr 13, 2010, at 3:15 AM, SandeepTagore wrote: > > Hi All, > I am using Solr 1.4 (10 November 2009 release), Lucene core 2.9.2, LocalSolr > 2.0, LocalLucene 2.0, Tomcat 5.5 > > I get the following error when I try to sort the result by geo_distance. > Here is the stacktrace... > > SEVERE: java.lang.NullPointerException > at > org.apache.lucene.search.SortField.getComparator(SortField.java:496) > at > org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.<init>(FieldValueHitQueue.java:79) > at > org.apache.lucene.search.FieldValueHitQueue.create(FieldValueHitQueue.java:192) > at > org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:886) > at > org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:981) > at > org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:884) > at > org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341) > at > org.apache.solr.search.SolrIndexSearcher.getDocList(SolrIndexSearcher.java:1161) > at > com.pjaol.search.solr.component.LocalSolrQueryComponent.process(LocalSolrQueryComponent.java:286) > at > org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195) > at > org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131) > at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316) > > > Commented the following line in org.apache.lucene.search.SortField > return comparatorSource.newComparator(field, numHits, sortPos, reverse); > and added the following line temporarily. > return new FieldComparator.DoubleComparator(numHits, field, parser); > > Changed geo_distance type to double from sdouble in my schema.xml. > Then it works. But i think its a bug in lucene 2.9.2 code. It will always > give NPE. > > Here are the original two lines from the file > org.apache.lucene.search.SortField [getComparator() method, lucene 2.9.2]... > assert factory == null && comparatorSource != null; > return comparatorSource.newComparator(field, numHits, sortPos, reverse); > > And factory = com.pjaol.search.geo.utils.distancesortsou...@1568654 and > comparatorSource = null always. So it always call newComparator() on null. > > Can anyone help me with this, please? > > Thank you very much for your support. > > Regards, > Sandeep > -- > View this message in context: > http://n3.nabble.com/Error-while-sorting-by-geo-distance-in-Solr-1-4-tp715415p715415.html > Sent from the Solr - User mailing list archive at Nabble.com. -------------------------- Grant Ingersoll http://www.lucidimagination.com/ Search the Lucene ecosystem using Solr/Lucene: http://www.lucidimagination.com/search