@Override ObjectNode toJson() { final ObjectNode obj = mapper.createObjectNode(); final ArrayNode bool = obj.putArray(BooleanPropertyParser.BOOLEAN_PROPERTY); for (final QueryClause clause : clauses) { final ObjectNode e = bool.addObject(); e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString()); e.putAll(clause.getQuery().toJson()); } return obj; }
@Override public org.apache.lucene.search.BooleanQuery toQuery(final boolean proxy) throws QueryNodeException { final org.apache.lucene.search.BooleanQuery query = new org.apache.lucene.search.BooleanQuery(true); // convert clauses for (final QueryClause clause : clauses) { // wrap node query into a lucene proxy query final Query q = new LuceneProxyNodeQuery( (org.sindice.siren.search.node.NodeQuery) clause.getQuery().toQuery(false)); query.add(q, clause.getBooleanOccur()); } // add boost if (this.hasBoost()) { query.setBoost(this.getBoost()); } return query; }