Package org.hibernate.search.bridge

Examples of org.hibernate.search.bridge.FieldBridge


    return getBridge( getMetadata(), fieldName );
  }

  private FieldBridge getBridge(PropertiesMetadata metadata, String fieldName) {
    //process base fields
    FieldBridge fieldBridge = getBridge( metadata.fieldNames, metadata.fieldBridges, fieldName );
    if ( fieldBridge != null ) {
      return fieldBridge;
    }

    //process fields of embedded
View Full Code Here


    else if ( indexNullAs.equals( org.hibernate.search.annotations.Field.DEFAULT_NULL_TOKEN ) ) {
      indexNullAs = context.getDefaultNullToken();
    }
    propertiesMetadata.fieldNullTokens.add( indexNullAs );

    FieldBridge fieldBridge = BridgeFactory.guessType( fieldAnn, numericFieldAnn, member, reflectionManager );
    if ( indexNullAs != null && fieldBridge instanceof TwoWayFieldBridge ) {
      fieldBridge = new NullEncodingTwoWayFieldBridge( (TwoWayFieldBridge) fieldBridge, indexNullAs );
    }
    propertiesMetadata.fieldBridges.add( fieldBridge );
View Full Code Here

        if ( idAnnotation instanceof DocumentId ) {
          explicitDocumentId = true;
        }
        idKeywordName = prefix + attributeName;

        FieldBridge fieldBridge = BridgeFactory.guessType( null, numericFieldAnn, member, reflectionManager );
        if ( fieldBridge instanceof TwoWayFieldBridge ) {
          idBridge = (TwoWayFieldBridge) fieldBridge;
        }
        else {
          throw new SearchException(
View Full Code Here

    // needed for field access: I cannot work in the proxied version
    Object unproxiedInstance = HibernateHelper.unproxy( instance );

    // process the class bridges
    for ( int i = 0; i < propertiesMetadata.classBridges.size(); i++ ) {
      FieldBridge fb = propertiesMetadata.classBridges.get( i );
      final String fieldName = propertiesMetadata.classNames.get( i );
      contextualBridge
          .setFieldBridge( fb )
          .setFieldName( fieldName )
          .set(
              fieldName, unproxiedInstance,
              doc, propertiesMetadata.getClassLuceneOptions( i )
          );
    }

    // process the indexed fields
    for ( int i = 0; i < propertiesMetadata.fieldNames.size(); i++ ) {
      XMember member = propertiesMetadata.fieldGetters.get( i );
      Object value = ReflectionHelper.getMemberValue( unproxiedInstance, member );

      final FieldBridge fieldBridge = propertiesMetadata.fieldBridges.get( i );
      final String fieldName = propertiesMetadata.fieldNames.get( i );
      contextualBridge
          .setFieldBridge( fieldBridge )
          .pushMethod( member.getName() )
          .setFieldName( fieldName )
View Full Code Here

    }
    if ( fieldName.equals( idKeywordName ) ) {
      return objectToString( idBridge, idKeywordName, value );
    }
    else {
      FieldBridge bridge = getBridge( getMetadata(), fieldName );
      if ( bridge != null ) {
        final Class<? extends FieldBridge> bridgeClass = bridge.getClass();
        if ( TwoWayFieldBridge.class.isAssignableFrom( bridgeClass ) ) {
          return objectToString( (TwoWayFieldBridge) bridge, fieldName, value );
        }
        else if ( StringBridge.class.isAssignableFrom( bridgeClass ) ) {
          return objectToString( (StringBridge) bridge, fieldName, value );
View Full Code Here

    return getBridge( getMetadata(), fieldName );
  }

  private FieldBridge getBridge(PropertiesMetadata metadata, String fieldName) {
    //process base fields
    FieldBridge fieldBridge = getBridge( metadata.fieldNames, metadata.fieldBridges, fieldName );
    if ( fieldBridge != null ) {
      return fieldBridge;
    }

    //process fields of embedded
View Full Code Here

        }
        if ( idAnnotation instanceof DocumentId ) {
          parseContext.setExplicitDocumentId( true );
        }

        FieldBridge idBridge = BridgeFactory.guessType( null, numericFieldAnn, member, reflectionManager );
        if ( !( idBridge instanceof TwoWayFieldBridge ) ) {
          throw new SearchException(
              "Bridge for document id does not implement TwoWayFieldBridge: " + member.getName()
          );
        }

        Field.TermVector termVector = AnnotationProcessingHelper.getTermVector( TermVector.NO );
        DocumentFieldMetadata fieldMetadata =
            new DocumentFieldMetadata.Builder(
                prefix + attributeName,
                Store.YES,
                Field.Index.NOT_ANALYZED_NO_NORMS,
                termVector
            )
                .id()
                .boost( AnnotationProcessingHelper.getBoost( member, null ) )
                .fieldBridge( idBridge )
                .build();
        PropertyMetadata idPropertyMetadata = new PropertyMetadata.Builder( member )
            .addDocumentField( fieldMetadata )
            .build();
        typeMetadataBuilder.idProperty( idPropertyMetadata );
      }
      else {
        //component should index their document id
        String fieldName = prefix + attributeName;
        Field.Index index = AnnotationProcessingHelper.getIndex( Index.YES, Analyze.NO, Norms.YES );
        Field.TermVector termVector = AnnotationProcessingHelper.getTermVector( TermVector.NO );
        FieldBridge fieldBridge = BridgeFactory.guessType( null, null, member, reflectionManager );

        DocumentFieldMetadata fieldMetadata =
            new DocumentFieldMetadata.Builder( fieldName, Store.YES, index, termVector )
                .boost( AnnotationProcessingHelper.getBoost( member, null ) )
                .fieldBridge( fieldBridge )
View Full Code Here

      XClass clazz) {

    Map<FieldBridge, ClassBridge> classBridgeInstances = configContext.getClassBridgeInstances( reflectionManager.toClass( clazz ) );

    for ( Entry<FieldBridge, ClassBridge> classBridge : classBridgeInstances.entrySet() ) {
      FieldBridge instance = classBridge.getKey();
      ClassBridge configuration = classBridge.getValue();

      bindClassBridgeAnnotation( prefix, typeMetadataBuilder, configuration, instance, configContext );
    }
  }
View Full Code Here

  private void bindClassBridgeAnnotation(String prefix,
      TypeMetadata.Builder typeMetadataBuilder,
      ClassBridge classBridgeAnnotation,
      XClass clazz,
      ConfigContext configContext) {
    FieldBridge fieldBridge = BridgeFactory.extractType( classBridgeAnnotation, reflectionManager.toClass( clazz ) );
    bindClassBridgeAnnotation( prefix, typeMetadataBuilder, classBridgeAnnotation, fieldBridge, configContext );
  }
View Full Code Here

    String fieldName = prefix + ReflectionHelper.getAttributeName( member, spatialAnnotation.name() );
    Store store = spatialAnnotation.store();
    Field.Index index = AnnotationProcessingHelper.getIndex( Index.YES, Analyze.NO, Norms.NO );
    Field.TermVector termVector = Field.TermVector.NO;
    FieldBridge fieldBridge = BridgeFactory.guessType(
        null,
        null,
        member,
        reflectionManager
    );
View Full Code Here

TOP

Related Classes of org.hibernate.search.bridge.FieldBridge

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.