Package org.hibernate.search.bridge

Examples of org.hibernate.search.bridge.FieldBridge


    // 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

    } 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

  }

  public Query createQuery(FieldContext fieldContext) {
    final Query perFieldQuery;
    final DocumentBuilderIndexedEntity<?> documentBuilder = Helper.getDocumentBuilder( queryContext );
    FieldBridge fieldBridge = documentBuilder.getBridge( fieldContext.getField() );
    if ( fieldBridge instanceof NumericFieldBridge ) {
      return NumericFieldUtils.createExactMatchQuery( fieldContext.getField(), value );
    }

    String searchTerm = buildSearchTerm( fieldContext, documentBuilder );
View Full Code Here

            amendedProperties.putAll(indexingProperties);
            amendedProperties.put(Environment.MODEL_MAPPING, mapping);
            indexingProperties = amendedProperties;
         }
         Cache cache = cr.getComponent(Cache.class);
         FieldBridge fb = (FieldBridge) fbClass.getConstructor(Cache.class).newInstance(cache);
         mapping.entity(Util.loadClassStrict("org.infinispan.query.remote.indexing.ProtobufValueWrapper", cl))
               .indexed().classBridgeInstance(fb).norms(Norms.NO).analyze(Analyze.YES).store(Store.YES);
      } catch (Exception e) {
         throw new CacheException("Failed to configure indexing for remote query", e);
      }
View Full Code Here

        if ( idKeywordName != null ) {
          throw new AssertionFailure( "Two document id assigned: "
              + idKeywordName + " and " + BinderHelper.getAttributeName( member, documentIdAnn.name() ) );
        }
        idKeywordName = prefix + BinderHelper.getAttributeName( member, documentIdAnn.name() );
        FieldBridge fieldBridge = BridgeFactory.guessType( null, member, reflectionManager );
        if ( fieldBridge instanceof TwoWayFieldBridge ) {
          idBridge = (TwoWayFieldBridge) fieldBridge;
        }
        else {
          throw new SearchException(
View Full Code Here

  private void buildDocumentFields(Object instance, Document doc, PropertiesMetadata propertiesMetadata) {
    if ( instance == null ) return;
    //needed for field access: I cannot work in the proxied version
    Object unproxiedInstance = unproxy( instance );
    for (int i = 0; i < propertiesMetadata.classBridges.size(); i++) {
      FieldBridge fb = propertiesMetadata.classBridges.get( i );
      fb.set( propertiesMetadata.classNames.get( i ), unproxiedInstance,
          doc, propertiesMetadata.getClassLuceneOptions( i ) );
    }
    for (int i = 0; i < propertiesMetadata.fieldNames.size(); i++) {
      XMember member = propertiesMetadata.fieldGetters.get( i );
      Object value = getMemberValue( unproxiedInstance, member );
View Full Code Here

  public BuiltinNumericIterableBridge(FieldBridge fieldBridge) {
    super( fieldBridge );
  }

  public BuiltinNumericIterableBridge() {
    super( new FieldBridge() {

      @Override
      public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
        if ( value == null ) {
          manageNull( name, document, luceneOptions );
View Full Code Here

  public BuiltinNumericMapBridge(FieldBridge fieldBridge) {
    super( fieldBridge );
  }

  public BuiltinNumericMapBridge() {
    super( new FieldBridge() {

      @Override
      public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
        if ( value == null ) {
          manageNull( name, document, luceneOptions );
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.