當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。