Package org.hibernate.search.cfg

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


    verifyIndexCompleteMetadataOption( true, cfg );
  }

  private void verifyIndexCompleteMetadataOption(boolean expectation, SearchConfigurationForTest cfg) {
    SearchMapping mapping = new SearchMapping();
    mapping
      .entity( Document.class ).indexed().indexName( "index1" )
      .property( "id", ElementType.FIELD ).documentId()
      .property( "title", ElementType.FIELD ).field()
      ;
    cfg.setProgrammaticMapping( mapping );
View Full Code Here


    verifyTransactionsExpectedOption( true, cfg );
  }

  private void verifyTransactionsExpectedOption(boolean expectation, 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

  public ExpectedException exceptions = ExpectedException.none();

  @Test
  public void exceptionThrownWhenNotEnabled() {
    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

  }

  @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

  }

  @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

  }

  @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

  }

  @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

  }

  @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

    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

  }

  @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

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.