Package org.springframework.data.mongodb.core.index.TextIndexDefinition

Examples of org.springframework.data.mongodb.core.index.TextIndexDefinition.TextIndexDefinitionBuilder


    return createCompoundIndexDefinitions(dotPath, collection, entity);
  }

  private Collection<? extends IndexDefinitionHolder> potentiallyCreateTextIndexDefinition(MongoPersistentEntity<?> root) {

    TextIndexDefinitionBuilder indexDefinitionBuilder = new TextIndexDefinitionBuilder().named(root.getType()
        .getSimpleName() + "_TextIndex");

    if (StringUtils.hasText(root.getLanguage())) {
      indexDefinitionBuilder.withDefaultLanguage(root.getLanguage());
    }

    try {
      appendTextIndexInformation("", indexDefinitionBuilder, root,
          new TextIndexIncludeOptions(IncludeStrategy.DEFAULT), new CycleGuard());
    } catch (CyclicPropertyReferenceException e) {
      LOGGER.warn(e.getMessage());
    }

    TextIndexDefinition indexDefinition = indexDefinitionBuilder.build();

    if (!indexDefinition.hasFieldSpec()) {
      return Collections.emptyList();
    }
View Full Code Here


  @Before
  public void setUp() {

    template.indexOps(FullTextDocument.class).ensureIndex(
        new TextIndexDefinitionBuilder().onField("title").onField("content").build());
    this.repo = new MongoRepositoryFactory(this.template).getRepository(FullTextRepository.class);
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.index.TextIndexDefinition.TextIndexDefinitionBuilder

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.