本文整理汇总了Java中org.elasticsearch.test.ESTestCase.copyWriteable方法的典型用法代码示例。如果您正苦于以下问题:Java ESTestCase.copyWriteable方法的具体用法?Java ESTestCase.copyWriteable怎么用?Java ESTestCase.copyWriteable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.test.ESTestCase
的用法示例。
在下文中一共展示了ESTestCase.copyWriteable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mutate
import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private static RescoreBuilder<?> mutate(RescoreBuilder<?> original) throws IOException {
RescoreBuilder<?> mutation = ESTestCase.copyWriteable(original, namedWriteableRegistry, QueryRescorerBuilder::new);
if (randomBoolean()) {
Integer windowSize = original.windowSize();
if (windowSize != null) {
mutation.windowSize(windowSize + 1);
} else {
mutation.windowSize(randomIntBetween(0, 100));
}
} else {
QueryRescorerBuilder queryRescorer = (QueryRescorerBuilder) mutation;
switch (randomIntBetween(0, 3)) {
case 0:
queryRescorer.setQueryWeight(queryRescorer.getQueryWeight() + 0.1f);
break;
case 1:
queryRescorer.setRescoreQueryWeight(queryRescorer.getRescoreQueryWeight() + 0.1f);
break;
case 2:
QueryRescoreMode other;
do {
other = randomFrom(QueryRescoreMode.values());
} while (other == queryRescorer.getScoreMode());
queryRescorer.setScoreMode(other);
break;
case 3:
// only increase the boost to make it a slightly different query
queryRescorer.getRescoreQuery().boost(queryRescorer.getRescoreQuery().boost() + 0.1f);
break;
default:
throw new IllegalStateException("unexpected random mutation in test");
}
}
return mutation;
}
示例2: copy
import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private SmoothingModel copy(SmoothingModel original) throws IOException {
return ESTestCase.copyWriteable(original, namedWriteableRegistry,
namedWriteableRegistry.getReader(SmoothingModel.class, original.getWriteableName()));
}
示例3: serializedCopy
import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private static HighlightBuilder serializedCopy(HighlightBuilder original) throws IOException {
return ESTestCase.copyWriteable(original, namedWriteableRegistry, HighlightBuilder::new);
}
示例4: copyBuilder
import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private SearchSourceBuilder copyBuilder(SearchSourceBuilder original) throws IOException {
return ESTestCase.copyWriteable(original, namedWriteableRegistry, SearchSourceBuilder::new);
}
示例5: serializedCopy
import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private static InnerHitBuilder serializedCopy(InnerHitBuilder original) throws IOException {
return ESTestCase.copyWriteable(original, namedWriteableRegistry, InnerHitBuilder::new);
}
示例6: copyShape
import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
protected static <T extends NamedWriteable> T copyShape(T original) throws IOException {
@SuppressWarnings("unchecked")
Reader<T> reader = (Reader<T>) namedWriteableRegistry.getReader(ShapeBuilder.class, original.getWriteableName());
return ESTestCase.copyWriteable(original, namedWriteableRegistry, reader);
}