Package org.sindice.siren.qparser.json.nodes

Examples of org.sindice.siren.qparser.json.nodes.TopLevelQueryNode


  public TopLevelQueryNodeBuilder() {}

  @Override
  public Query build(final QueryNode queryNode) throws QueryNodeException {
    final TopLevelQueryNode topNode = (TopLevelQueryNode) queryNode;
    final QueryNode child = topNode.getChildren().get(0);
    final Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);

    if (child instanceof BooleanQueryNode) {
      // no need to wrap the query object into a lucene proxy query
      return (Query) obj;
View Full Code Here


  public QueryNode parse(final CharSequence query, final CharSequence field)
  throws QueryNodeParseException {
    try {
      final JsonNode node = mapper.readTree(query.toString());
      final String fieldname = this.getFirstFieldName(node);
      final TopLevelQueryNode topNode = new TopLevelQueryNode();

      // check for node property
      if (fieldname.equals(NodePropertyParser.NODE_PROPERTY)) {
        final NodePropertyParser nodeParser = new NodePropertyParser(node, field);
        topNode.add(nodeParser.parse());
        return topNode;
      }
      // check for twig property
      if (fieldname.equals(TwigPropertyParser.TWIG_PROPERTY)) {
        final TwigPropertyParser twigParser = new TwigPropertyParser(node, field);
        topNode.add(twigParser.parse());
        return topNode;
      }
      // check for boolean property
      if (fieldname.equals(BooleanPropertyParser.BOOLEAN_PROPERTY)) {
        final BooleanPropertyParser booleanParser = new BooleanPropertyParser(node, field);
        topNode.add(booleanParser.parse());
        return topNode;
      }
      throw new ParseException("Invalid JSON query: unknown property '" + fieldname + "'");
    }
    catch (final IOException e) {
View Full Code Here

TOP

Related Classes of org.sindice.siren.qparser.json.nodes.TopLevelQueryNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.