Example #1
0
 Index convert(final Text text, final String nameToStore) {
   return new IndexBuilder()
       .options(text.options())
       .fields(
           Collections.<Field>singletonList(
               new FieldBuilder().value(nameToStore).type(IndexType.TEXT).weight(text.value())));
 }
Example #2
0
  @Test
  public void textPartialFilters() {
    MongoCollection<Document> collection = getDatabase().getCollection("indexes");
    MappedClass mappedClass = getMorphia().getMapper().getMappedClass(IndexedClass.class);

    Text text =
        new TextBuilder()
            .value(4)
            .options(new IndexOptionsBuilder().partialFilter("{ name : { $gt : 13 } }"));

    indexHelper.createIndex(collection, mappedClass, indexHelper.convert(text, "text"), false);
    findPartialIndex(BasicDBObject.parse(text.options().partialFilter()));
  }