Package org.hibernate.search.cfg

Examples of org.hibernate.search.cfg.SearchMapping


    }

    if ( modelMappingProperty == null) {
      return null;
    }
    SearchMapping mapping = null;
    Object programmaticConfig = modelMappingProperty;
    if (programmaticConfig instanceof SearchMapping) {
      mapping = (SearchMapping) programmaticConfig;
      return mapping;
    }
View Full Code Here


    validateMappingFactoryDefinition(count, clazz);
    return mapping;
  }

  private static SearchMapping getNewInstanceOfSearchMapping(Class<?> clazz, Method method) {
    SearchMapping mapping = null;
    try {
      LOG.debugf("invoking factory method [ %s.%s ] to get search mapping instance", clazz.getName(), method.getName());
      Object instance = clazz.newInstance();
      mapping = (SearchMapping) method.invoke(instance);
    } catch (Exception e) {
View Full Code Here

  public SearchFactoryImpl(SearchConfiguration cfg) {
    this.configurationProperties = cfg.getProperties();
    this.errorHandler = createErrorHandler( configurationProperties );
    ReflectionManager reflectionManager = getReflectionManager(cfg);
    final SearchMapping mapping = SearchMappingBuilder.getSearchMapping(cfg);
    if ( mapping != null) {
      if ( ! ( reflectionManager instanceof MetadataProviderInjector)) {
        throw new SearchException("Programmatic mapping model used but ReflectionManager does not implement "
            + MetadataProviderInjector.class.getName() );
      }
View Full Code Here

      cfg = new ReflectionReplacingSearchConfiguration( reflectionManager, cfg );
    }

    BuildContext buildContext = new BuildContext();

    final SearchMapping mapping = SearchMappingBuilder.getSearchMapping( cfg );
    applySearchMappingToMetadata( reflectionManager, mapping );

    factoryState.setSearchMapping( mapping ); // might be null if feature is not used

    factoryState.setIndexingStrategy( defineIndexingStrategy( cfg ) );//need to be done before the document builds
View Full Code Here

      cfg = new ReflectionReplacingSearchConfiguration( reflectionManager, cfg );
    }

    BuildContext buildContext = new BuildContext();

    final SearchMapping mapping = SearchMappingBuilder.getSearchMapping( cfg );
    applySearchMappingToMetadata( reflectionManager, mapping );

    factoryState.setSearchMapping( mapping ); // might be null if feature is not used

    factoryState.setIndexingStrategy( defineIndexingStrategy( cfg ) );//need to be done before the document builds
View Full Code Here

  private ReflectionManager getReflectionManager(SearchConfiguration cfg) {
    ReflectionManager reflectionManager = cfg.getReflectionManager();
    if ( reflectionManager == null ) {
      reflectionManager = new JavaReflectionManager();
    }
    final SearchMapping mapping = cfg.getProgrammaticMapping();
    if ( mapping != null) {
      if ( ! ( reflectionManager instanceof MetadataProviderInjector)) {
        throw new SearchException("Programmatic mapping model used but ReflectionManager does not implement "
            + MetadataProviderInjector.class.getName() );
      }
View Full Code Here

      cfg = new ReflectionReplacingSearchConfiguration( reflectionManager, cfg );
    }

    BuildContext buildContext = new BuildContext();

    final SearchMapping mapping = SearchMappingBuilder.getSearchMapping( cfg );
    applySearchMappingToMetadata( reflectionManager, mapping );

    factoryState.setSearchMapping( mapping ); // might be null if feature is not used

    factoryState.setIndexingStrategy( defineIndexingStrategy( cfg ) );//need to be done before the document builds
View Full Code Here

   }

   private Properties addProgrammaticMappings(Properties indexingProperties, ComponentRegistry cr) {
      Iterator<ProgrammaticSearchMappingProvider> providers = ServiceFinder.load(ProgrammaticSearchMappingProvider.class).iterator();
      if (providers.hasNext()) {
         SearchMapping mapping = (SearchMapping) indexingProperties.get(Environment.MODEL_MAPPING);
         if (mapping == null) {
            mapping = new SearchMapping();
            Properties amendedProperties = new Properties();
            amendedProperties.putAll(indexingProperties);
            amendedProperties.put(Environment.MODEL_MAPPING, mapping);
            indexingProperties = amendedProperties;
         }
View Full Code Here

    final ReflectionManager reflectionManager = getReflectionManager( cfg );

    BuildContext buildContext = new BuildContext();

    final SearchMapping mapping = SearchMappingBuilder.getSearchMapping( cfg );
    if ( mapping != null ) {
      if ( !( reflectionManager instanceof MetadataProviderInjector ) ) {
        throw new SearchException(
            "Programmatic mapping model used but ReflectionManager does not implement "
                + MetadataProviderInjector.class.getName()
View Full Code Here

        }
      }
    }

    // Add the hibernate history entities programmatically:
    final SearchMapping mapping = new SearchMapping();
    mapping.entity(HistoryEntry.class).indexed() //
    .property("id", ElementType.METHOD).documentId().name("id")//
    .property("userName", ElementType.METHOD).field().index(Index.UN_TOKENIZED).store(Store.NO) //
    // Must be tokenized for using lower case (MultiFieldQueryParser uses lower case strings):
    .property("className", ElementType.METHOD).field().index(Index.TOKENIZED).store(Store.NO) //
    .property("timestamp", ElementType.METHOD).field().store(Store.NO).dateBridge(Resolution.MINUTE) //
View Full Code Here

TOP

Related Classes of org.hibernate.search.cfg.SearchMapping

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.