Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.browseengine.bobo.geosearch.query;
  import java.util.List;

Shane Detsch
Ken McCracken
 public class GeoWeight extends Weight {
     private static final long serialVersionUID = 1L;
     private final GeoQuery geoQuery;
     private float queryWeight;
     private float queryNorm;
     private float value;
     public GeoWeight(GeoQuery geoQuery) {
         this. = geoQuery;

     public Explanation explain(IndexReader readerint docthrows IOException {
         // TODO: improve this to provide the actual distance component of the score, 
         // and explain how we take smoothed 1/distance^2.
         return new Explanation(doc.toString()+", queryNorm: "+);

     public Query getQuery() {
         return ;
The GeoScorer.nextDoc() should give you the capability to go through all the documents that are within 'rangeInMiles' of the centroid by increasing order of document id.
     public Scorer scorer(IndexReader readerboolean scoreDocsInOrder,
             boolean topScorerthrows IOException {
         if (!(reader instanceof GeoIndexReader)) {
             throw new RuntimeException("attempt to create a "
                     +GeoScorer.class+" with a reader that was not a "
         GeoIndexReader geoIndexReader = (GeoIndexReaderreader;
         List<GeoSegmentReader<CartesianGeoRecord>> segmentsInOrder = geoIndexReader.getGeoSegmentReaders();
         IDeletedDocs wholeIndexDeletedDocs = new IndexReaderDeletedDocs(reader);
         return new GeoScorer(thissegmentsInOrderwholeIndexDeletedDocs
     public float getValue() {
         return ;

     public void normalize(float queryNorm) {
         this. = queryNorm;
          *= queryNorm;                   // normalize query weight
         // idf is effectively 1
          = ;                  // idf for document

    public float sumOfSquaredWeights() throws IOException {
        // idf is effectively 1
         = .getBoost();
        return  * ;
New to GrepCode? Check out our FAQ X