Package org.hibernate.search.analyzer

Examples of org.hibernate.search.analyzer.Discriminator


   * analyzer definition names. This map will be added to the <code>Work</code> instance and processed at actual indexing time.
   * @param processedFieldNames A list of field names we have already processed.
   * @param unproxiedInstance The entity we currently "add" to the document.
   */
  private void allowAnalyzerDiscriminatorOverride(Document doc, PropertiesMetadata propertiesMetadata, Map<String, String> fieldToAnalyzerMap, Set<String> processedFieldNames, Object unproxiedInstance) {
    Discriminator discriminator = propertiesMetadata.discriminator;
    if ( discriminator == null ) {
      return;
    }

    Object value = null;
    if ( propertiesMetadata.discriminatorGetter != null ) {
      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
View Full Code Here


   * analyzer definition names. This map will be added to the <code>Work</code> instance and processed at actual indexing time.
   * @param processedFieldNames A list of field names we have already processed.
   * @param unproxiedInstance The entity we currently "add" to the document.
   */
  private void allowAnalyzerDiscriminatorOverride(Document doc, PropertiesMetadata propertiesMetadata, Map<String, String> fieldToAnalyzerMap, Set<String> processedFieldNames, Object unproxiedInstance) {
    Discriminator discriminator = propertiesMetadata.discriminator;
    if ( discriminator == null ) {
      return;
    }

    Object value = null;
    if ( propertiesMetadata.discriminatorGetter != null ) {
      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
View Full Code Here

      //if the discriminator is calculated on a @Transient field, we can't trust field level dirtyness
      typeMetadataBuilder.disableStateInspectionOptimization();
    }

    Class<? extends Discriminator> discriminatorClass = discriminatorAnnotation.impl();
    Discriminator discriminator;
    try {
      discriminator = discriminatorClass.newInstance();
    }
    catch (Exception e) {
      throw new SearchException(
View Full Code Here

   * analyzer definition names. This map will be added to the <code>Work</code> instance and processed at actual indexing time.
   * @param processedFieldNames A list of field names we have already processed.
   * @param unproxiedInstance The entity we currently "add" to the document.
   */
  private void allowAnalyzerDiscriminatorOverride(Document doc, PropertiesMetadata propertiesMetadata, Map<String, String> fieldToAnalyzerMap, Set<String> processedFieldNames, Object unproxiedInstance) {
    Discriminator discriminator = propertiesMetadata.discriminator;
    if ( discriminator == null ) {
      return;
    }

    Object value = null;
    if ( propertiesMetadata.discriminatorGetter != null ) {
      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
View Full Code Here

      TypeMetadata typeMetadata,
      Map<String, String> fieldToAnalyzerMap,
      Set<String> processedFieldNames,
      Object unproxiedInstance) {

    Discriminator discriminator = typeMetadata.getDiscriminator();
    if ( discriminator == null ) {
      return;
    }

    Object value = null;
    if ( typeMetadata.getDiscriminatorGetter() != null ) {
      value = ReflectionHelper.getMemberValue( unproxiedInstance, typeMetadata.getDiscriminatorGetter() );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
View Full Code Here

   * analyzer definition names. This map will be added to the <code>Work</code> instance and processed at actual indexing time.
   * @param processedFieldNames A list of field names we have already processed.
   * @param unproxiedInstance The entity we currently "add" to the document.
   */
  private void allowAnalyzerDiscriminatorOverride(Document doc, PropertiesMetadata propertiesMetadata, Map<String, String> fieldToAnalyzerMap, Set<String> processedFieldNames, Object unproxiedInstance) {
    Discriminator discriminator = propertiesMetadata.discriminator;
    if ( discriminator == null ) {
      return;
    }

    Object value = null;
    if ( propertiesMetadata.discriminatorGetter != null ) {
      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
View Full Code Here

   * analyzer definition names. This map will be added to the <code>Work</code> instance and processed at actual indexing time.
   * @param processedFieldNames A list of field names we have already processed.
   * @param unproxiedInstance The entity we currently "add" to the document.
   */
  private void allowAnalyzerDiscriminatorOverride(Document doc, PropertiesMetadata propertiesMetadata, Map<String, String> fieldToAnalyzerMap, Set<String> processedFieldNames, Object unproxiedInstance) {
    Discriminator discriminator = propertiesMetadata.discriminator;
    if ( discriminator == null ) {
      return;
    }

    Object value = null;
    if ( propertiesMetadata.discriminatorGetter != null ) {
      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
View Full Code Here

      //if the discriminator is calculated on a @Transient field, we can't trust field level dirtyness
      typeMetadataBuilder.disableStateInspectionOptimization();
    }

    Class<? extends Discriminator> discriminatorClass = discriminatorAnnotation.impl();
    Discriminator discriminator = ClassLoaderHelper.instanceFromClass( Discriminator.class, discriminatorClass, "analyzer discriminator implementation" );

    if ( annotatedElement instanceof XMember ) {
      typeMetadataBuilder.analyzerDiscriminator( discriminator, (XMember) annotatedElement );
    }
    else {
View Full Code Here

      //if the discriminator is calculated on a @Transient field, we can't trust field level dirtyness
      typeMetadataBuilder.disableStateInspectionOptimization();
    }

    Class<? extends Discriminator> discriminatorClass = discriminatorAnnotation.impl();
    Discriminator discriminator = ClassLoaderHelper.instanceFromClass( Discriminator.class, discriminatorClass, "analyzer discriminator implementation" );

    if ( annotatedElement instanceof XMember ) {
      typeMetadataBuilder.analyzerDiscriminator( discriminator, (XMember) annotatedElement );
    }
    else {
View Full Code Here

   * analyzer definition names. This map will be added to the <code>Work</code> instance and processed at actual indexing time.
   * @param processedFieldNames A list of field names we have already processed.
   * @param unproxiedInstance The entity we currently "add" to the document.
   */
  private void allowAnalyzerDiscriminatorOverride(Document doc, PropertiesMetadata propertiesMetadata, Map<String, String> fieldToAnalyzerMap, Set<String> processedFieldNames, Object unproxiedInstance) {
    Discriminator discriminator = propertiesMetadata.discriminator;
    if ( discriminator == null ) {
      return;
    }

    Object value = null;
    if ( propertiesMetadata.discriminatorGetter != null ) {
      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
View Full Code Here

TOP

Related Classes of org.hibernate.search.analyzer.Discriminator

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.