Package org.hibernate.search.cfg

Examples of org.hibernate.search.cfg.SearchMapping


  @Test
  public void testGetIndexedTypeSingleIndexedType() {
    SearchConfigurationForTest cfg = getManualConfiguration();

    SearchMapping mapping = new SearchMapping();
    mapping
        .entity( Foo.class ).indexed()
        .property( "id", FIELD ).documentId()
    ;
    cfg.setProgrammaticMapping( mapping );
View Full Code Here


  @Test
  public void testGetIndexedTypesMultipleTypes() {
    SearchConfigurationForTest cfg = getManualConfiguration();

    SearchMapping mapping = new SearchMapping();
    mapping
        .entity( Foo.class ).indexed()
        .property( "id", FIELD ).documentId()
        .entity( Bar.class ).indexed()
        .property( "id", FIELD ).documentId()
    ;
View Full Code Here

  @Test
  public void testGetTypeDescriptorForIndexedType() {
    SearchConfigurationForTest cfg = getManualConfiguration();

    SearchMapping mapping = new SearchMapping();
    mapping
        .entity( Foo.class ).indexed()
        .property( "id", FIELD ).documentId()
    ;
    cfg.setProgrammaticMapping( mapping );
View Full Code Here

public class ProgrammaticSearchMappingFactory {

  @Factory
  public SearchMapping build() {
    SearchMapping mapping = new SearchMapping();

    mapping.fullTextFilterDef( "security", SecurityFilterFactory.class ).cache( FilterCacheModeType.INSTANCE_ONLY )
        .analyzerDef( "ngram", StandardTokenizerFactory.class )
          .filter( LowerCaseFilterFactory.class )
          .filter( NGramFilterFactory.class )
            .param( "minGramSize", "3" )
            .param( "maxGramSize", "3" )
View Full Code Here

      );
    }
  }

  private SearchMapping createSearchMapping() {
    SearchMapping mapping = new SearchMapping();

    mapping.analyzerDef( "english", StandardTokenizerFactory.class )
        .filter( LowerCaseFilterFactory.class )
        .filter( SnowballPorterFilterFactory.class )
        .analyzerDef(
            "english", StandardTokenizerFactory.class
        ) // ups duplicate name here - this should throw an exception
View Full Code Here

   * Defines a programmatic configuration to be used by Search
   *
   * @return the enabled SearchMapping. change it to define the mapping programmatically.
   */
  public SearchMapping fluentMapping() {
    SearchMapping mapping = (SearchMapping) cfg.get( org.hibernate.search.cfg.Environment.MODEL_MAPPING );
    if ( mapping == null ) {
      mapping = new SearchMapping();
      cfg.put( org.hibernate.search.cfg.Environment.MODEL_MAPPING, mapping );
    }
    return mapping;
  }
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

      } catch (ClassNotFoundException e) {
         return indexingProperties;
      }

      try {
         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;
         }
         Cache cache = cr.getComponent(Cache.class);
         FieldBridge fb = (FieldBridge) fbClass.getConstructor(Cache.class).newInstance(cache);
         mapping.entity(Class.forName("org.infinispan.query.remote.indexing.ProtobufValueWrapper"))
               .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);
      }
      return indexingProperties;
View Full Code Here

    }

    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.debug("invoking factory method [ {}.{} ] 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

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.