本文整理匯總了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);
}