当前位置: 首页>>代码示例>>Java>>正文


Java ESTestCase.copyWriteable方法代码示例

本文整理汇总了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;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:36,代码来源:QueryRescoreBuilderTests.java

示例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()));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:SmoothingModelTestCase.java

示例3: serializedCopy

import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private static HighlightBuilder serializedCopy(HighlightBuilder original) throws IOException {
    return ESTestCase.copyWriteable(original, namedWriteableRegistry, HighlightBuilder::new);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:HighlightBuilderTests.java

示例4: copyBuilder

import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private SearchSourceBuilder copyBuilder(SearchSourceBuilder original) throws IOException {
    return ESTestCase.copyWriteable(original, namedWriteableRegistry, SearchSourceBuilder::new);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:SearchSourceBuilderTests.java

示例5: serializedCopy

import org.elasticsearch.test.ESTestCase; //导入方法依赖的package包/类
private static InnerHitBuilder serializedCopy(InnerHitBuilder original) throws IOException {
    return ESTestCase.copyWriteable(original, namedWriteableRegistry, InnerHitBuilder::new);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:InnerHitBuilderTests.java

示例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);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:AbstractShapeBuilderTestCase.java


注:本文中的org.elasticsearch.test.ESTestCase.copyWriteable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。