Examples of TopLevelQueryNode


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

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

  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

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

  private QueryConfigHandler queryConfig;

  @Override
  public QueryNode process(final QueryNode queryTree)
  throws QueryNodeException {
    final TopLevelQueryNode top = (TopLevelQueryNode) queryTree;

    if (this.getQueryConfigHandler().has(KeywordConfigurationKeys.ALLOW_TWIG)) {
      if (!this.getQueryConfigHandler().get(KeywordConfigurationKeys.ALLOW_TWIG)) {
        // Wraps the children into a BooleanQueryNode, so that the parent
        // pointers are correct.
        // This relies on the BooleanSingleChildOptimizationQueryNodeProcessor
        return new BooleanQueryNode(top.getChildren());
      }
    } else {
      throw new IllegalArgumentException("KeywordConfigurationKeys.ALLOW_TWIG should be set on the KeywordQueryConfigHandler");
    }
    return queryTree;
View Full Code Here

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

      this.queryNodeList = actualQueryNodeList;
      this.latestNodeVerified = false;
    }
    else if (node instanceof TopLevelQueryNode) {
      final ArrayList<QueryNode> actualQueryNodeList = this.queryNodeList;
      final TopLevelQueryNode topNode = (TopLevelQueryNode) node;
      final QueryNode child = topNode.getChildren().get(0);
      topNode.set(Arrays.asList(this.process(child)));
      actualQueryNodeList.add(topNode);
      this.queryNodeList = actualQueryNodeList;
      this.latestNodeVerified = false;
    }
    else if (node instanceof DatatypeQueryNode) {
View Full Code Here

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

implements KeywordQueryBuilder {

  @Override
  public Query build(final QueryNode queryNode)
  throws QueryNodeException {
    final TopLevelQueryNode top = (TopLevelQueryNode) queryNode;
    final Query q = (Query) top.getChildren().get(0)
                               .getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);

    return this.wrap(q);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.