Examples of SearchMapping


Examples of org.hibernate.search.cfg.SearchMapping

    storeBooksViaProvidedId( cfg, ProvidedId.defaultFieldName, false );
  }

  @Test
  public void usingConfigurationTypeOverride() {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( Book.class ).indexed()
      //Entity missing both @DocumentId and @ProvidedId:
      .property( "title", ElementType.FIELD ).field()
      .property( "text", ElementType.FIELD ).field()
      ;
View Full Code Here

Examples of org.hibernate.search.cfg.SearchMapping

    storeBooksViaProvidedId( cfg, ProvidedId.defaultFieldName, false );
  }

  @Test
  public void usingProvidedIdAsOptionsOverride() {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( Book.class ).indexed()
        .providedId().name( "myID" )
      //Entity missing both @DocumentId and @ProvidedId:
      .property( "title", ElementType.FIELD ).field()
      .property( "text", ElementType.FIELD ).field()
View Full Code Here

Examples of org.hibernate.search.cfg.SearchMapping

    storeBooksViaProvidedId( cfg, "myID", false );
  }

  @Test
  public void usingExplicitProvidedId() {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( Book.class ).indexed()
        .providedId().name( "myID" )
      //Entity missing both @DocumentId and @ProvidedId:
      .property( "title", ElementType.FIELD ).field()
      .property( "text", ElementType.FIELD ).field()
View Full Code Here

Examples of org.hibernate.search.cfg.SearchMapping

    storeBooksViaProvidedId( cfg, "myID", false );
  }

  @Test
  public void usingDefaultSettings() {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( Book.class ).indexed()
        .providedId().name( "myID" )
      //Entity missing both @DocumentId and @ProvidedId:
      .property( "title", ElementType.FIELD ).field()
      .property( "text", ElementType.FIELD ).field()
View Full Code Here

Examples of org.hibernate.search.cfg.SearchMapping

    storeBooksViaProvidedId( cfg, "myID", false );
  }

  @Test
  public void documentIdNotOverriden() {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( Book.class ).indexed()
        .property( "title", ElementType.FIELD ).documentId()
        .property( "text", ElementType.FIELD ).field()
      ;
    SearchConfigurationForTest cfg = new SearchConfigurationForTest()
View Full Code Here

Examples of org.hibernate.search.cfg.SearchMapping

    verifyIndexManagerTypeIs( NRTIndexManager.class, configurationForTest );
  }

  private void verifyIndexManagerTypeIs(Class<? extends IndexManager> expectedIndexManagerClass, SearchConfigurationForTest cfg) {
    SearchMapping mapping = new SearchMapping();
    mapping
        .entity( Document.class ).indexed().indexName( "documents" )
        .property( "id", ElementType.FIELD ).documentId()
        .property( "title", ElementType.FIELD ).field();

    cfg.setProgrammaticMapping( mapping );
View Full Code Here

Examples of org.hibernate.search.cfg.SearchMapping

    verifyOptimizerImplementationIs( CustomOptimizer.class, cfg );
  }

  @SuppressWarnings("unchecked")
  private void verifyOptimizerImplementationIs(Class type, SearchConfigurationForTest cfg) {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( Document.class ).indexed()
      .property( "id", ElementType.FIELD ).documentId()
      .property( "title", ElementType.FIELD ).field()
      ;
    cfg.setProgrammaticMapping( mapping );
View Full Code Here

Examples of org.hibernate.search.cfg.SearchMapping

    searchFactory.addClasses( AddressBook.class );
    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

Examples of org.hibernate.search.cfg.SearchMapping

  private SearchConfigurationForTest manualConfiguration;

  @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

Examples of org.hibernate.search.cfg.SearchMapping

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

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

    try {
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.