Package org.apache.lucene.search.FieldCache

Examples of org.apache.lucene.search.FieldCache.Doubles


    assertEquals(0, longs.get(0));
   
    Floats floats = cache.getFloats(ar, "bogusfloats", true);
    assertEquals(0, floats.get(0), 0.0f);
   
    Doubles doubles = cache.getDoubles(ar, "bogusdoubles", true);
    assertEquals(0, doubles.get(0), 0.0D);
   
    BytesRef scratch = new BytesRef();
    BinaryDocValues binaries = cache.getTerms(ar, "bogusterms", true);
    binaries.get(0, scratch);
    assertEquals(0, scratch.length);
View Full Code Here


   * @param reader reader to the index
   */
  @Override
  public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
    final AtomicReader atomicReader = context.reader();
    final Doubles latitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, getLatitudeField(), false );
    final Doubles longitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, getLongitudeField(), false );

    DocIdSet docs = previousFilter.getDocIdSet( context, acceptDocs );

    if ( ( docs == null ) || ( docs.iterator() == null ) ) {
      return null;
    }

    return new FilteredDocIdSet( docs ) {
      @Override
      protected boolean match(int documentIndex) {

        if ( center.getDistanceTo( latitudeValues.get( documentIndex ), longitudeValues.get( documentIndex ) ) <= radius ) {
          return true;
        }
        else {
          return false;
        }
View Full Code Here

  }

  @Override
  public DistanceComparator setNextReader(final AtomicReaderContext newContext) throws IOException {
    final AtomicReader atomicReader = newContext.reader();
    final Doubles unbasedLatitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, latitudeField, false );
    final Doubles unbasedLongitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, longitudeField, false );
    this.docBase = newContext.docBase;
    final int numDocs = atomicReader.numDocs();
    for ( int i = 0; i < numDocs; i++ ) {
      //TODO avoid fully copying this structure
      latitudeValues.put( this.docBase + i, unbasedLatitudeValues.get( i ) );
      longitudeValues.put( this.docBase + i, unbasedLongitudeValues.get( i ) );
    }
    return this;
  }
View Full Code Here

  @Override
  public void setNextReader(AtomicReaderContext newContext) throws IOException {
    delegate.setNextReader( newContext );
    final AtomicReader atomicReader = newContext.reader();
    final int numDocs = atomicReader.numDocs();
    final Doubles unbasedLatitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, latitudeField, false );
    final Doubles unbasedLongitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, longitudeField, false );

    this.docBase = newContext.docBase;
    for ( int i = 0 ; i < numDocs; i ++ ) {
      //TODO avoid fully copying this structure - HSEARCH-1499
      latitudeValues.put( this.docBase + i, unbasedLatitudeValues.get( i ) );
      longitudeValues.put( this.docBase + i, unbasedLongitudeValues.get( i ) );
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.FieldCache.Doubles

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.