Package org.hibernate.search.engine

Examples of org.hibernate.search.engine.DocumentBuilderIndexedEntity


            mappedXClass, cfg, buildContext, reflectionManager
        );
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderIndexedEntity<?> documentBuilder =
            new DocumentBuilderIndexedEntity(
                mappedXClass,
                context,
                providers,
                reflectionManager
        );

        indexingHierarchy.addIndexedClass( mappedClass );
        documentBuildersIndexedEntities.put( mappedClass, documentBuilder );
      }
      else {
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderContainedEntity<?> documentBuilder = new DocumentBuilderContainedEntity(
            mappedXClass, context, reflectionManager
        );
        //TODO enhance that, I don't like to expose EntityState
        if ( documentBuilder.getEntityState() != EntityState.NON_INDEXABLE ) {
          documentBuildersContainedEntities.put( mappedClass, documentBuilder );
        }
      }
      bindFilterDefs( mappedXClass );
      //TODO should analyzer def for classes at tyher sqme level???
View Full Code Here


          involvedClasses.addAll( builder.getMappedSubclasses() );
        }
      }

      for ( Class clazz : involvedClasses ) {
        DocumentBuilderIndexedEntity builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null ) {
          throw new HibernateException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );
        }
        if ( builder.getIdKeywordName() != null ) {
          idFieldNames.add( builder.getIdKeywordName() );
          allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
        }
        searcherSimilarity = checkSimilarity( searcherSimilarity, builder );
        populateDirectories( targetedDirectories, builder );
      }
      this.classesAndSubclasses = involvedClasses;
View Full Code Here

          involvedClasses.addAll( builder.getMappedSubclasses() );
        }
      }

      for ( Class clazz : involvedClasses ) {
        DocumentBuilderIndexedEntity builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null ) {
          throw new HibernateException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );
        }
        if ( builder.getIdKeywordName() != null ) {
          idFieldNames.add( builder.getIdKeywordName() );
          allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
        }
        searcherSimilarity = checkSimilarity( searcherSimilarity, builder );
        populateDirectories( targetedDirectories, builder );
      }
      this.classesAndSubclasses = involvedClasses;
View Full Code Here

        DirectoryProviderFactory.DirectoryProviders providers = factory.createDirectoryProviders(
            mappedXClass, cfg, buildContext, reflectionManager
        );
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderIndexedEntity<?> documentBuilder = new DocumentBuilderIndexedEntity(
            mappedXClass, context, providers.getProviders(), providers.getSelectionStrategy(),
            reflectionManager
        );

        indexHierarchy.addIndexedClass( mappedClass );
        documentBuildersIndexedEntities.put( mappedClass, documentBuilder );
      }
      else {
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderContainedEntity<?> documentBuilder = new DocumentBuilderContainedEntity(
            mappedXClass, context, reflectionManager
        );
        //TODO enhance that, I don't like to expose EntityState
        if ( documentBuilder.getEntityState() != EntityState.NON_INDEXABLE ) {
          documentBuildersContainedEntities.put( mappedClass, documentBuilder );
        }
      }
      bindFilterDefs( mappedXClass );
      //TODO should analyzer def for classes at tyher sqme level???
View Full Code Here

            mappedXClass, cfg, buildContext, reflectionManager
        );
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderIndexedEntity<?> documentBuilder =
            new DocumentBuilderIndexedEntity(
                mappedXClass,
                context,
                providers,
                reflectionManager
            );

        indexingHierarchy.addIndexedClass( mappedClass );
        documentBuildersIndexedEntities.put( mappedClass, documentBuilder );
      }
      else {
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderContainedEntity<?> documentBuilder = new DocumentBuilderContainedEntity(
            mappedXClass, context, reflectionManager
        );
        //TODO enhance that, I don't like to expose EntityState
        if ( documentBuilder.getEntityState() != EntityState.NON_INDEXABLE ) {
          documentBuildersContainedEntities.put( mappedClass, documentBuilder );
        }
      }
      bindFilterDefs( mappedXClass );
      //TODO should analyzer def for classes at their same level???
View Full Code Here

          involvedClasses.addAll( builder.getMappedSubclasses() );
        }
      }

      for ( Class clazz : involvedClasses ) {
        DocumentBuilderIndexedEntity builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null ) {
          throw new SearchException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );
        }
        if ( builder.getIdKeywordName() != null ) {
          idFieldNames.add( builder.getIdKeywordName() );
          allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
        }
        searcherSimilarity = checkSimilarity( searcherSimilarity, builder );
        useFieldCacheOnClassTypes = useFieldCacheOnClassTypes || builder.getFieldCacheOption().contains( FieldCacheType.CLASS );
        populateDirectories( targetedDirectories, builder );
      }
      this.classesAndSubclasses = involvedClasses;
    }
    this.idFieldNames = idFieldNames;
View Full Code Here

  @SuppressWarnings("unchecked")
  private void index( Object entity, Session session ) throws InterruptedException {
    Serializable id = session.getIdentifier( entity );
    Class<?> clazz = HibernateHelper.getClass( entity );
    DocumentBuilderIndexedEntity docBuilder = documentBuilders.get( clazz );
    if ( docBuilder == null ) {
      // it might be possible to receive not-indexes subclasses of the currently indexed type;
      // being not-indexed, we skip them.
      // FIXME for improved performance: avoid loading them in an early phase.
      return;
    }
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass(clazz)
        .setFieldName(docBuilder.getIdKeywordName())
        .setFieldBridge(idBridge);
    String idInString = contextualBridge.objectToString( id );
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, true );
    backend.enqueueAsyncWork( addWork );
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  private void index( Object entity, Session session ) throws InterruptedException {
    Serializable id = session.getIdentifier( entity );
    Class clazz = Hibernate.getClass( entity );
    DocumentBuilderIndexedEntity docBuilder = documentBuilders.get( clazz );
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    String idInString = idBridge.objectToString( id );
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, true );
    backend.enqueueAsyncWork( addWork );
  }
View Full Code Here

        DirectoryProviderFactory.DirectoryProviders providers = factory.createDirectoryProviders(
            mappedXClass, cfg, buildContext, reflectionManager
        );
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderIndexedEntity<?> documentBuilder = new DocumentBuilderIndexedEntity(
            mappedXClass, context, providers.getProviders(), providers.getSelectionStrategy(),
            reflectionManager
        );

        indexingHierarchy.addIndexedClass( mappedClass );
        documentBuildersIndexedEntities.put( mappedClass, documentBuilder );
      }
      else {
        //FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
        //XClass unfortunately is not (yet) genericized: TODO?
        final DocumentBuilderContainedEntity<?> documentBuilder = new DocumentBuilderContainedEntity(
            mappedXClass, context, reflectionManager
        );
        //TODO enhance that, I don't like to expose EntityState
        if ( documentBuilder.getEntityState() != EntityState.NON_INDEXABLE ) {
          documentBuildersContainedEntities.put( mappedClass, documentBuilder );
        }
      }
      bindFilterDefs( mappedXClass );
      //TODO should analyzer def for classes at tyher sqme level???
View Full Code Here

  @SuppressWarnings("unchecked")
  private void index( Object entity, Session session ) throws InterruptedException {
    Serializable id = session.getIdentifier( entity );
    Class<?> clazz = HibernateHelper.getClass( entity );
    DocumentBuilderIndexedEntity docBuilder = documentBuilders.get( clazz );
    if ( docBuilder == null ) {
      // it might be possible to receive not-indexes subclasses of the currently indexed type;
      // being not-indexed, we skip them.
      // FIXME for improved performance: avoid loading them in an early phase.
      return;
    }
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass(clazz)
        .setFieldName(docBuilder.getIdKeywordName())
        .setFieldBridge(idBridge);
    String idInString = contextualBridge.objectToString( id );
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, true );
    backend.enqueueAsyncWork( addWork );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.engine.DocumentBuilderIndexedEntity

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.