Hi everyone,

I am trying to retrieve all results within a given bounding box in a 2-D
space. I understand that the scoring function is based on the distance from
the center of the query. I am not looking to retrieve top-k results, but all
of them. 

I have read previous forums on this similar question, and the solutions are
either out-dated (for previous versions) or inefficient (Option 1: input k
as INTEGER.MAX_VALUE, Option 2: use a TotalHitCountCollector and get the
total number of results using getTotalHits and then pass on this number to
the top-k search). 

I am looking for all the results in the bounding box, and do not care for
the order. I do not want to waste any computation, if possible, on any
sorting needed for top-k functionality.

Question: Is there any better solution out there that I can use instead of
the above mentioned solutions?

Any reply is much appreciated. Thanks!


Snippet of the code of the above mentioned Option 1:

SpatialArgs args = new SpatialArgs(SpatialOperation.IsWithin,
ctx.makeRectangle(minX, maxX, minY, maxY));

Filter filter = strategy.makeFilter(args);
TopDocs topDocs = searcher.search(new MatchAllDocsQuery(), filter,
Integer.MAX_VALUE);

ScoreDoc[] scoreDocs = topDocs.scoreDocs; 
for (ScoreDoc s : scoreDocs) 
{ 
       Document doc = searcher.doc(s.doc); 
       System.out.println(doc.get("id") + "\t" + doc.get("name")); 
}




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Lucene-Spatial-Question-How-to-retrieve-all-results-within-a-bounding-box-tp4140616.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

Reply via email to