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


Java XContentParser.binaryValue方法代码示例

本文整理汇总了Java中org.elasticsearch.common.xcontent.XContentParser.binaryValue方法的典型用法代码示例。如果您正苦于以下问题:Java XContentParser.binaryValue方法的具体用法?Java XContentParser.binaryValue怎么用?Java XContentParser.binaryValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.xcontent.XContentParser的用法示例。


在下文中一共展示了XContentParser.binaryValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromXContent

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static WrapperQueryBuilder fromXContent(QueryParseContext parseContext) throws IOException {
    XContentParser parser = parseContext.parser();

    XContentParser.Token token = parser.nextToken();
    if (token != XContentParser.Token.FIELD_NAME) {
        throw new ParsingException(parser.getTokenLocation(), "[wrapper] query malformed");
    }
    String fieldName = parser.currentName();
    if (! QUERY_FIELD.match(fieldName)) {
        throw new ParsingException(parser.getTokenLocation(), "[wrapper] query malformed, expected `query` but was " + fieldName);
    }
    parser.nextToken();

    byte[] source = parser.binaryValue();

    parser.nextToken();

    if (source == null) {
        throw new ParsingException(parser.getTokenLocation(), "wrapper query has no [query] specified");
    }
    return new WrapperQueryBuilder(source);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:WrapperQueryBuilder.java

示例2: readValue

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
static Object readValue(XContentParser parser, MapFactory mapFactory, XContentParser.Token token) throws IOException {
    if (token == XContentParser.Token.VALUE_NULL) {
        return null;
    } else if (token == XContentParser.Token.VALUE_STRING) {
        return parser.text();
    } else if (token == XContentParser.Token.VALUE_NUMBER) {
        return parser.numberValue();
    } else if (token == XContentParser.Token.VALUE_BOOLEAN) {
        return parser.booleanValue();
    } else if (token == XContentParser.Token.START_OBJECT) {
        return readMap(parser, mapFactory);
    } else if (token == XContentParser.Token.START_ARRAY) {
        return readList(parser, mapFactory);
    } else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {
        return parser.binaryValue();
    }
    return null;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:AbstractXContentParser.java

示例3: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
    XContentParser parser = parseContext.parser();

    XContentParser.Token token = parser.nextToken();
    if (token != XContentParser.Token.FIELD_NAME) {
        throw new QueryParsingException(parseContext, "[wrapper] query malformed");
    }
    String fieldName = parser.currentName();
    if (!fieldName.equals("query")) {
        throw new QueryParsingException(parseContext, "[wrapper] query malformed");
    }
    parser.nextToken();

    byte[] querySource = parser.binaryValue();
    try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) {
        final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParserService());
        context.reset(qSourceParser);
        Query result = context.parseInnerQuery();
        parser.nextToken();
        parseContext.combineNamedQueries(context);
        return result;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:WrapperQueryParser.java

示例4: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext context) throws Exception {
    byte[] aggSource = parser.binaryValue();
    try (XContentParser aSourceParser = XContentFactory.xContent(aggSource).createParser(aggSource)) {
        aSourceParser.nextToken(); // move past the first START_OBJECT
        super.parse(aSourceParser, context);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:AggregationBinaryParseElement.java

示例5: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext context) throws Exception {
    byte[] filterSource = parser.binaryValue();
    try (XContentParser fSourceParser = XContentFactory.xContent(filterSource).createParser(filterSource)) {
        ParsedQuery filter = context.queryParserService().parseInnerFilter(fSourceParser);
        if (filter != null) {
            context.parsedPostFilter(filter);
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:FilterBinaryParseElement.java

示例6: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext context) throws Exception {
    byte[] querySource = parser.binaryValue();
    try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) {
        context.parsedQuery(context.queryParserService().parse(qSourceParser));
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:QueryBinaryParseElement.java

示例7: readValue

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
static Object readValue(XContentParser parser, MapFactory mapFactory, XContentParser.Token token) throws IOException {
    if (token == XContentParser.Token.VALUE_NULL) {
        return null;
    } else if (token == XContentParser.Token.VALUE_STRING) {
        return parser.text();
    } else if (token == XContentParser.Token.VALUE_NUMBER) {
        XContentParser.NumberType numberType = parser.numberType();
        if (numberType == XContentParser.NumberType.INT) {
            return parser.intValue();
        } else if (numberType == XContentParser.NumberType.LONG) {
            return parser.longValue();
        } else if (numberType == XContentParser.NumberType.FLOAT) {
            return parser.floatValue();
        } else if (numberType == XContentParser.NumberType.DOUBLE) {
            return parser.doubleValue();
        }
    } else if (token == XContentParser.Token.VALUE_BOOLEAN) {
        return parser.booleanValue();
    } else if (token == XContentParser.Token.START_OBJECT) {
        return readMap(parser, mapFactory);
    } else if (token == XContentParser.Token.START_ARRAY) {
        return readList(parser, mapFactory);
    } else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {
        return parser.binaryValue();
    }
    return null;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:28,代码来源:AbstractXContentParser.java


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