Package org.hibernate.search.engine.metadata.impl

Examples of org.hibernate.search.engine.metadata.impl.DocumentFieldMetadata


    return getBridge( getMetadata(), fieldName );
  }

  private FieldBridge getBridge(TypeMetadata typeMetadata, String fieldName) {
    // process base fields
    DocumentFieldMetadata documentFieldMetadata = typeMetadata.getDocumentFieldMetadataFor( fieldName );
    if ( documentFieldMetadata != null && documentFieldMetadata.getFieldBridge() != null ) {
      return documentFieldMetadata.getFieldBridge();
    }

    // process embedded fields
    FieldBridge fieldBridge;

    for ( EmbeddedTypeMetadata embeddedTypeMetadata : typeMetadata.getEmbeddedTypeMetadata() ) {
      fieldBridge = getBridge( embeddedTypeMetadata, fieldName );
      if ( fieldBridge != null ) {
        return fieldBridge;
      }
    }

    // process null embedded fields
    for ( EmbeddedTypeMetadata embeddedTypeMetadata : typeMetadata.getEmbeddedTypeMetadata() ) {
      fieldBridge = getNullBridge( embeddedTypeMetadata, fieldName );
      if ( fieldBridge != null ) {
        return fieldBridge;
      }
    }

    //process class bridges
    DocumentFieldMetadata fieldMetadata = typeMetadata.getFieldMetadataForClassBridgeField( fieldName );
    fieldBridge = fieldMetadata == null ? null : fieldMetadata.getFieldBridge();
    return fieldBridge;
  }
View Full Code Here


      providedIdFieldName = ProvidedId.defaultFieldName;
      idProvided = true;
    }

    if ( idProvided ) {
      DocumentFieldMetadata fieldMetadata =
          new DocumentFieldMetadata.Builder(
              providedIdFieldName,
              Store.YES,
              Field.Index.NOT_ANALYZED_NO_NORMS,
              Field.TermVector.NO
View Full Code Here

    return id;
  }

  @Override
  public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, List<LuceneWork> queue, ConversionContext contextualBridge) {
    DocumentFieldMetadata idFieldMetadata = idPropertyMetadata.getFieldMetadata( idFieldName );
    String idInString = objectToString( getIdBridge(), idFieldMetadata.getName(), id, contextualBridge );
    if ( delete && !add ) {
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
    }
    else if ( add && !delete ) {
      queue.add(
View Full Code Here

            Field.TermVector.NO
        );
    doc.add( classField );

    // now add the entity id to the document
    DocumentFieldMetadata idFieldMetaData = idPropertyMetadata.getFieldMetadata( idFieldName );

    LuceneOptions luceneOptions = new LuceneOptionsImpl( idFieldMetaData );
    final FieldBridge contextualizedBridge = conversionContext.oneWayConversionContext( getIdBridge() );
    conversionContext.setClass( entityType );
    conversionContext.pushProperty( idFieldMetaData.getName() );

    try {
      contextualizedBridge.set( idFieldMetaData.getName(), id, doc, luceneOptions );
    }
    finally {
      conversionContext.popProperty();
    }
View Full Code Here

  public String objectToString(String fieldName, Object value, ConversionContext conversionContext) {
    if ( fieldName == null ) {
      throw new AssertionFailure( "Field name should not be null" );
    }

    final DocumentFieldMetadata idFieldMetaData = idPropertyMetadata.getFieldMetadata( idFieldName );
    final FieldBridge bridge = fieldName.equals( idFieldMetaData.getName() ) ?
        getIdBridge() :
        getBridge( getMetadata(), fieldName );

    if ( bridge != null ) {
      return objectToString( fieldName, bridge, value, conversionContext );
View Full Code Here

    return getBridge( getMetadata(), fieldName );
  }

  private FieldBridge getBridge(TypeMetadata typeMetadata, String fieldName) {
    // process base fields
    DocumentFieldMetadata documentFieldMetadata = typeMetadata.getDocumentFieldMetadataFor( fieldName );
    if ( documentFieldMetadata != null && documentFieldMetadata.getFieldBridge() != null ) {
      return documentFieldMetadata.getFieldBridge();
    }

    // process embedded fields
    FieldBridge fieldBridge;

    for ( EmbeddedTypeMetadata embeddedTypeMetadata : typeMetadata.getEmbeddedTypeMetadata() ) {
      fieldBridge = getBridge( embeddedTypeMetadata, fieldName );
      if ( fieldBridge != null ) {
        return fieldBridge;
      }
    }

    // process null embedded fields
    for ( EmbeddedTypeMetadata embeddedTypeMetadata : typeMetadata.getEmbeddedTypeMetadata() ) {
      fieldBridge = getNullBridge( embeddedTypeMetadata, fieldName );
      if ( fieldBridge != null ) {
        return fieldBridge;
      }
    }

    //process class bridges
    DocumentFieldMetadata fieldMetadata = typeMetadata.getFieldMetadataForClassBridgeField( fieldName );
    fieldBridge = fieldMetadata == null ? null : fieldMetadata.getFieldBridge();
    return fieldBridge;
  }
View Full Code Here

      providedIdFieldName = ProvidedId.defaultFieldName;
      idProvided = true;
    }

    if ( idProvided ) {
      DocumentFieldMetadata fieldMetadata =
          new DocumentFieldMetadata.Builder(
              providedIdFieldName,
              Store.YES,
              Field.Index.NOT_ANALYZED_NO_NORMS,
              Field.TermVector.NO
View Full Code Here

    return id;
  }

  @Override
  public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, List<LuceneWork> queue, ConversionContext contextualBridge) {
    DocumentFieldMetadata idFieldMetadata = idPropertyMetadata.getFieldMetadata( idFieldName );
    String idInString = objectToString( getIdBridge(), idFieldMetadata.getName(), id, contextualBridge );
    if ( delete && !add ) {
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
    }
    else if ( add && !delete ) {
      queue.add(
View Full Code Here

            Field.TermVector.NO
        );
    doc.add( classField );

    // now add the entity id to the document
    DocumentFieldMetadata idFieldMetaData = idPropertyMetadata.getFieldMetadata( idFieldName );

    LuceneOptions luceneOptions = new LuceneOptionsImpl( idFieldMetaData, idFieldMetaData.getBoost(), documentLevelBoost );
    final FieldBridge contextualizedBridge = conversionContext.oneWayConversionContext( getIdBridge() );
    conversionContext.setClass( entityType );
    conversionContext.pushProperty( idFieldMetaData.getName() );

    try {
      contextualizedBridge.set( idFieldMetaData.getName(), id, doc, luceneOptions );
    }
    finally {
      conversionContext.popProperty();
    }
View Full Code Here

  public String objectToString(String fieldName, Object value, ConversionContext conversionContext) {
    if ( fieldName == null ) {
      throw new AssertionFailure( "Field name should not be null" );
    }

    final DocumentFieldMetadata idFieldMetaData = idPropertyMetadata.getFieldMetadata( idFieldName );
    final FieldBridge bridge = fieldName.equals( idFieldMetaData.getName() ) ?
        getIdBridge() :
        getBridge( getMetadata(), fieldName );

    if ( bridge != null ) {
      return objectToString( fieldName, bridge, value, conversionContext );
View Full Code Here

TOP

Related Classes of org.hibernate.search.engine.metadata.impl.DocumentFieldMetadata

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.