Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

Author(s):
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;
     }

    
 
     @Override
     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: "+);
     }

    
 
     @Override
     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.
 
     @Override
     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.class);
         }
         GeoIndexReader geoIndexReader = (GeoIndexReaderreader;
         List<GeoSegmentReader<CartesianGeoRecord>> segmentsInOrder = geoIndexReader.getGeoSegmentReaders();
         IDeletedDocs wholeIndexDeletedDocs = new IndexReaderDeletedDocs(reader);
         
         return new GeoScorer(thissegmentsInOrderwholeIndexDeletedDocs
     }
    
    
 
     @Override
     public float getValue() {
         return ;
     }

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

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