Package org.hibernate.search.cfg

Examples of org.hibernate.search.cfg.SearchMapping.entity()


    Assert.assertNotNull( searchFactory.getIndexManagerHolder().getIndexManager( "addressBookIndex" ) );
  }

  static SearchMapping buildMappingDefinition() {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( TelephoneRecord.class )
        .indexed()
          .indexName( "phoneNumbersIndex" )
        .property( "id", ElementType.FIELD ).documentId()
        .property( "phone", ElementType.FIELD ).field().analyze( Analyze.NO ).store( Store.YES )
View Full Code Here


  @Before
  public void setUp() {
    manualConfiguration = new SearchConfigurationForTest();
    SearchMapping searchMapping = new SearchMapping();
    searchMapping.entity( Document.class ).indexed()
        .property( "id", ElementType.FIELD ).documentId()
        .property( "title", ElementType.FIELD ).field();
    manualConfiguration.setProgrammaticMapping( searchMapping );
    manualConfiguration.addClass( Document.class );
  }
View Full Code Here

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

    SearchMapping mapping = new SearchMapping();
    mapping
        .entity( Foo.class ).indexed()
    ;
    cfg.setProgrammaticMapping( mapping );

    try {
View Full Code Here

  @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

            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

      }
    }

    // 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
Copyright © 2018 www.massapi.com. 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.