Hi "sc", I suspect you are hitting OOM for makeDistanceValueSource call on RecursivePrefixTreeStrategy. That strategy is best for filtering (the query), but it's a memory pig for distance sorting requirements. Instead, use PointVectorStrategy for the makeDistanceValueSource purpose. For that strategy, you only need it to do just that, so you can enable docValues and disable the "index". That strategy accepts a FieldType in the constructor. PointVectorStrategy is limited to one point per document per field, and always uses double precision on both "x" and "y". ~ David
On Fri, Jul 14, 2017 at 6:19 PM sc <scattaman...@4info.com> wrote: > Hi, > > Thanks for your suggestions that worked perfectly. > > But unfortunately our current application is still using JDK 1.7 and it > would take a while to move to JDK 1.8. So I started using older version of > Lucene 5.5.4 which supports 1.7, but its not working smoothly. I must be > doing something wrong while writing index. > > I am using the example from here > > https://github.com/apache/lucene-solr/blob/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/SpatialExample.java > > Indexing: > > Document doc = new Document(); > doc.add(new StoredField("id", id)); > > Point pt = ctx.makePoint(longitude, latitude); > for (IndexableField f : > strategy.createIndexableFields(pt)) { > doc.add(f); > } > > doc.add(new StoredField(strategy.getFieldName(), pt.getX() > + " " + > pt.getY())); > > return doc; > > > Searching: > > > Point p = ctx.makePoint(lng, lat); > Circle c = ctx.makeCircle(lng, lat, deg); > SpatialArgs args = new > SpatialArgs(SpatialOperation.Intersects, c); > Query query = strategy.makeQuery(args); > > ValueSource valueSource = > strategy.makeDistanceValueSource(p); > Sort distSort = new > Sort(valueSource.getSortField(false)).rewrite(searcher); > > int limit = 10; > TopDocs topDocs = searcher.search(query, limit, distSort); > > When running on loading index, its throwing OutOfMemory Exception. I > increased the memory to 4G and its failed. > > Any Suggestions, > > Thanks Much. > > > > > > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Lucene-GeoNear-Search-and-Sort-Performance-tp4343468p4346178.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > -- Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker LinkedIn: http://linkedin.com/in/davidwsmiley | Book: http://www.solrenterprisesearchserver.com