Package org.hibernate.search.query.engine.spi

Examples of org.hibernate.search.query.engine.spi.EntityInfo


            .targetedEntities(Arrays.asList(new Class<?>[]{ProtobufValueWrapper.class}))
            .projection("surname")
            .queryEntityInfos();

      assertEquals(1, queryEntityInfos.size());
      EntityInfo entityInfo = queryEntityInfos.get(0);
      assertEquals("Nistor", entityInfo.getProjection()[0]);
   }
View Full Code Here


  @Override
  public EntityInfo extract(int scoreDocIndex) throws IOException {
    int docId = queryHits.docId( scoreDocIndex );
    Document document = extractDocument( scoreDocIndex );

    EntityInfo entityInfo = extractEntityInfo( docId, document, scoreDocIndex, exceptionWrap );
    Object[] eip = entityInfo.getProjection();

    if ( eip != null && eip.length > 0 ) {
      for ( int x = 0; x < projection.length; x++ ) {
        if ( ProjectionConstants.SCORE.equals( projection[x] ) ) {
          eip[x] = queryHits.score( scoreDocIndex );
        }
        else if ( ProjectionConstants.ID.equals( projection[x] ) ) {
          eip[x] = entityInfo.getId();
        }
        else if ( ProjectionConstants.DOCUMENT.equals( projection[x] ) ) {
          eip[x] = document;
        }
        else if ( ProjectionConstants.DOCUMENT_ID.equals( projection[x] ) ) {
          eip[x] = docId;
        }
        else if ( ProjectionConstants.EXPLANATION.equals( projection[x] ) ) {
          eip[x] = queryHits.explain( scoreDocIndex );
        }
        else if ( ProjectionConstants.OBJECT_CLASS.equals( projection[x] ) ) {
          eip[x] = entityInfo.getClazz();
        }
        else if ( ProjectionConstants.SPATIAL_DISTANCE.equals( projection[x] ) ) {
          eip[x] = queryHits.spatialDistance( scoreDocIndex );
        }
        else if ( ProjectionConstants.THIS.equals( projection[x] ) ) {
          //THIS could be projected more than once
          //THIS loading delayed to the Loader phase
          entityInfo.getIndexesOfThis().add( x );
        }
      }
    }
    return entityInfo;
  }
View Full Code Here

            .targetedEntities(Collections.<Class<?>>singletonList(ProtobufValueWrapper.class))
            .projection("surname")
            .queryEntityInfos();

      assertEquals(1, queryEntityInfos.size());
      EntityInfo entityInfo = queryEntityInfos.get(0);
      assertEquals("Nistor", entityInfo.getProjection()[0]);
   }
View Full Code Here

  public EntityInfo extract(int scoreDocIndex) throws IOException {
    int docId = queryHits.docId( scoreDocIndex );
    Document document = extractDocument( scoreDocIndex );

    EntityInfo entityInfo = extractEntityInfo( docId, document, scoreDocIndex, exceptionWrap );
    Object[] eip = entityInfo.getProjection();

    if ( eip != null && eip.length > 0 ) {
      for ( int x = 0; x < projection.length; x++ ) {
        if ( ProjectionConstants.SCORE.equals( projection[x] ) ) {
          eip[x] = queryHits.score( scoreDocIndex );
        }
        else if ( ProjectionConstants.ID.equals( projection[x] ) ) {
          eip[x] = entityInfo.getId();
        }
        else if ( ProjectionConstants.DOCUMENT.equals( projection[x] ) ) {
          eip[x] = document;
        }
        else if ( ProjectionConstants.DOCUMENT_ID.equals( projection[x] ) ) {
          eip[x] = docId;
        }
        else if ( ProjectionConstants.EXPLANATION.equals( projection[x] ) ) {
          eip[x] = queryHits.explain( scoreDocIndex );
        }
        else if ( ProjectionConstants.OBJECT_CLASS.equals( projection[x] ) ) {
          eip[x] = entityInfo.getClazz();
        }
        else if ( ProjectionConstants.THIS.equals( projection[x] ) ) {
          //THIS could be projected more than once
          //THIS loading delayed to the Loader phase
          entityInfo.getIndexesOfThis().add( x );
        }
      }
    }
    return entityInfo;
  }
View Full Code Here

            .targetedEntities(Collections.<Class<?>>singletonList(ProtobufValueWrapper.class))
            .projection("surname")
            .queryEntityInfos();

      assertEquals(1, queryEntityInfos.size());
      EntityInfo entityInfo = queryEntityInfos.get(0);
      assertEquals("Nistor", entityInfo.getProjection()[0]);
   }
View Full Code Here

  public EntityInfo extract(int scoreDocIndex) throws IOException {
    int docId = queryHits.docId( scoreDocIndex );
    Document document = extractDocument( scoreDocIndex );

    EntityInfo entityInfo = extractEntityInfo( docId, document, scoreDocIndex );
    Object[] eip = entityInfo.getProjection();

    if ( eip != null && eip.length > 0 ) {
      for ( int x = 0; x < projection.length; x++ ) {
        if ( ProjectionConstants.SCORE.equals( projection[x] ) ) {
          eip[x] = queryHits.score( scoreDocIndex );
        }
        else if ( ProjectionConstants.ID.equals( projection[x] ) ) {
          eip[x] = entityInfo.getId();
        }
        else if ( ProjectionConstants.DOCUMENT.equals( projection[x] ) ) {
          eip[x] = document;
        }
        else if ( ProjectionConstants.DOCUMENT_ID.equals( projection[x] ) ) {
          eip[x] = docId;
        }
        else if ( ProjectionConstants.EXPLANATION.equals( projection[x] ) ) {
          eip[x] = queryHits.explain( scoreDocIndex );
        }
        else if ( ProjectionConstants.OBJECT_CLASS.equals( projection[x] ) ) {
          eip[x] = entityInfo.getClazz();
        }
        else if ( ProjectionConstants.THIS.equals( projection[x] ) ) {
          //THIS could be projected more than once
          //THIS loading delayed to the Loader phase
          entityInfo.getIndexesOfThis().add( x );
        }
      }
    }
    return entityInfo;
  }
View Full Code Here

  public EntityInfo extract(int index) throws IOException {
    int docId = queryHits.docId( index );
    Document document = extractDocument( index );

    EntityInfo entityInfo = extractEntityInfo( docId, document );
    Object[] eip = entityInfo.getProjection();

    if ( eip != null && eip.length > 0 ) {
      for ( int x = 0; x < projection.length; x++ ) {
        if ( ProjectionConstants.SCORE.equals( projection[x] ) ) {
          eip[x] = queryHits.score( index );
        }
        else if ( ProjectionConstants.ID.equals( projection[x] ) ) {
          eip[x] = entityInfo.getId();
        }
        else if ( ProjectionConstants.DOCUMENT.equals( projection[x] ) ) {
          eip[x] = document;
        }
        else if ( ProjectionConstants.DOCUMENT_ID.equals( projection[x] ) ) {
          eip[x] = docId;
        }
        else if ( ProjectionConstants.BOOST.equals( projection[x] ) ) {
          eip[x] = FLOAT_ONE;
        }
        else if ( ProjectionConstants.EXPLANATION.equals( projection[x] ) ) {
          eip[x] = queryHits.explain( index );
        }
        else if ( ProjectionConstants.OBJECT_CLASS.equals( projection[x] ) ) {
            eip[x] = entityInfo.getClazz();
        }
        else if ( ProjectionConstants.THIS.equals( projection[x] ) ) {
          //THIS could be projected more than once
          //THIS loading delayed to the Loader phase
          entityInfo.getIndexesOfThis().add( x );
        }
      }
    }
    return entityInfo;
  }
View Full Code Here

     * or reload them and update the cache entry.
     * @param x absolute position in fulltext result.
     * @return the managed objects
     */
    private Object[] getManagedResult(int x) {
      EntityInfo entityInfo = getEntityInfo( x );
      Object[] objects = entity == null ? null : entity.get();
      if ( objects != null && areAllEntitiesManaged( objects, entityInfo ) ) {
        return objects;
      }
      else {
View Full Code Here

     * Extract an entityInfo, either from cache or from the index.
     * @param x the position in the index.
     * @return
     */
    private EntityInfo getEntityInfo(int x) {
      EntityInfo entityInfo = einfo == null ? null : einfo.get();
      if ( entityInfo == null ) {
        try {
          entityInfo = documentExtractor.extract( x );
        }
        catch (IOException e) {
View Full Code Here

  @Override
  public EntityInfo extract(int scoreDocIndex) throws IOException {
    int docId = queryHits.docId( scoreDocIndex );
    Document document = extractDocument( scoreDocIndex );

    EntityInfo entityInfo = extractEntityInfo( docId, document, scoreDocIndex, exceptionWrap );
    Object[] eip = entityInfo.getProjection();

    if ( eip != null && eip.length > 0 ) {
      for ( int x = 0; x < projection.length; x++ ) {
        if ( ProjectionConstants.SCORE.equals( projection[x] ) ) {
          eip[x] = queryHits.score( scoreDocIndex );
        }
        else if ( ProjectionConstants.ID.equals( projection[x] ) ) {
          eip[x] = entityInfo.getId();
        }
        else if ( ProjectionConstants.DOCUMENT.equals( projection[x] ) ) {
          eip[x] = document;
        }
        else if ( ProjectionConstants.DOCUMENT_ID.equals( projection[x] ) ) {
          eip[x] = docId;
        }
        else if ( ProjectionConstants.EXPLANATION.equals( projection[x] ) ) {
          eip[x] = queryHits.explain( scoreDocIndex );
        }
        else if ( ProjectionConstants.OBJECT_CLASS.equals( projection[x] ) ) {
          eip[x] = entityInfo.getClazz();
        }
        else if ( ProjectionConstants.SPATIAL_DISTANCE.equals( projection[x] ) ) {
          eip[x] = queryHits.spatialDistance( scoreDocIndex );
        }
        else if ( ProjectionConstants.THIS.equals( projection[x] ) ) {
          //THIS could be projected more than once
          //THIS loading delayed to the Loader phase
          entityInfo.getIndexesOfThis().add( x );
        }
      }
    }
    return entityInfo;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.query.engine.spi.EntityInfo

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.