Package org.hibernate.search.bridge

Examples of org.hibernate.search.bridge.FieldBridge


        }
        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, clazz, configContext );
    }
  }
View Full Code Here

  private void bindClassBridgeAnnotation(String prefix,
      TypeMetadata.Builder typeMetadataBuilder,
      ClassBridge classBridgeAnnotation,
      XClass clazz,
      ConfigContext configContext) {
    FieldBridge fieldBridge = BridgeFactory.extractType( classBridgeAnnotation, clazz );
    bindClassBridgeAnnotation( prefix, typeMetadataBuilder, classBridgeAnnotation, fieldBridge, clazz, 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

    parseContext.markSpatialNameAsUsed( spatialAnnotation.name() );

    Store store = spatialAnnotation.store();
    Field.Index index = AnnotationProcessingHelper.getIndex( Index.YES, Analyze.NO, Norms.NO );
    Field.TermVector termVector = AnnotationProcessingHelper.getTermVector( TermVector.NO );
    FieldBridge spatialBridge = determineSpatialFieldBridge( spatialAnnotation, parseContext );

    DocumentFieldMetadata fieldMetadata = new DocumentFieldMetadata.Builder( fieldName, store, index, termVector )
        .boost( spatialAnnotation.boost().value() )
        .fieldBridge( spatialBridge )
        .build();
View Full Code Here

      throw new AssertionFailure( "Analyzer should not be undefined" );
    }
  }

  private FieldBridge determineSpatialFieldBridge(Spatial spatialAnnotation, ParseContext parseContext) {
    final FieldBridge spatialBridge;
    XClass clazz = parseContext.getCurrentClass();
    if ( reflectionManager.toXClass( Coordinates.class ).isAssignableFrom( clazz ) ) {
      spatialBridge = BridgeFactory.buildSpatialBridge( spatialAnnotation, clazz, null, null );
    }
    else {
View Full Code Here

        fieldAnnotation.analyze(),
        fieldAnnotation.norms()
    );
    Field.TermVector termVector = AnnotationProcessingHelper.getTermVector( fieldAnnotation.termVector() );

    FieldBridge fieldBridge = BridgeFactory.guessType(
        fieldAnnotation,
        numericFieldAnnotation,
        member,
        reflectionManager
    );
View Full Code Here

        parseContext.setCurrentClass( previousClass );

        final String indexNullAs = embeddedNullToken( configContext, indexedEmbeddedAnnotation );
        if ( indexNullAs != null ) {
          EmbeddedTypeMetadata.Container container = embeddedTypeMetadataBuilder.getEmbeddedContainerType();
          FieldBridge fieldBridge = guessNullEmbeddedBridge( member, container, indexNullAs );
          embeddedTypeMetadataBuilder.indexNullToken(
              indexNullAs,
              embeddedNullField( localPrefix ),
              fieldBridge
          );
View Full Code Here

    if ( EmbeddedTypeMetadata.Container.OBJECT == container ) {
      return new NullEncodingFieldBridge( NULL_EMBEDDED_STRING_BRIDGE, indexNullAs );
    }
    else {
      NumericField numericField = member.getAnnotation( NumericField.class );
      FieldBridge fieldBridge = BridgeFactory.guessType( null, numericField, member, reflectionManager );
      if ( fieldBridge instanceof StringBridge ) {
        fieldBridge = new NullEncodingFieldBridge( (StringBridge) fieldBridge, indexNullAs );
      }
      return fieldBridge;
    }
View Full Code Here

    final String fieldName = fieldContext.getField();
    final Analyzer queryAnalyzer = queryContext.getQueryAnalyzer();

    final DocumentBuilderIndexedEntity<?> documentBuilder = Helper.getDocumentBuilder( queryContext );

    FieldBridge fieldBridge = documentBuilder.getBridge( fieldContext.getField() );

    final Object fromObject = rangeContext.getFrom();
    final Object toObject = rangeContext.getTo();

    if ( fieldBridge != null && NumericFieldBridge.class.isAssignableFrom( fieldBridge.getClass() ) ) {
      perFieldQuery = NumericFieldUtils.createNumericRangeQuery(
          fieldName,
          fromObject,
          toObject,
          !rangeContext.isExcludeFrom(),
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.