@Test public void rev_search_with_arraycond() throws Exception { Projection p = projection("[{'field':'*','recursive':1},{'field':'us','recursive':1}]"); QueryExpression q = query("{'array':'us.*.authentications','elemMatch':{ '$and':[ { 'field':'principal','op':'$in','values':['a']}, {'field':'providerName','op':'$eq','rvalue':'p'} ] } }"); GMD gmd = new GMD(p, null); CompositeMetadata md = CompositeMetadata.buildCompositeMetadata(getMd("composite/L.json"), gmd); Set<CompositeMetadata> minimalTree = new HashSet<>(); minimalTree.add(md); minimalTree.add(md.getChildMetadata(new Path("us"))); QueryPlan searchQP = new QueryPlanChooser(md, new BruteForceQueryPlanIterator(), new IndexedFieldScorer(), q, minimalTree).choose(); QueryPlan retrievalQP = new QueryPlanChooser(md, new First(), new SimpleScorer(), q, minimalTree).choose(); ExecutionPlan ep = new ExecutionPlan(q,p, null, null, null, md, searchQP, retrievalQP, ctx); ObjectNode j = (ObjectNode) ep.toJson(); System.out.println("rev_search_with_arraycond"); System.out.println(JsonUtils.prettyPrint(j)); System.out.println("minimal tree:" + minimalTree); JsonNode source = j.get("source"); Assert.assertEquals("L", source.get("assemble").get("entity").asText()); Assert.assertEquals("U", source.get("assemble").get("left").get("copy").get("source").get("join-search").get("join").get(0).get("entity").asText()); Assert.assertEquals(1, source.get("assemble").get("right").size()); }
public JsonNode toJson() { return resultStep.toJson(); }
ExecutionPlan { public JsonNode toJson() { return resultStep.toJson(); } }
ExecutionPlan { public JsonNode toJson() { return resultStep.toJson(); } ExecutionPlan(QueryExpression requestQuery,
                         Projection requestProjection,
                         Sort requestSort,
                         Long from,
                         Long to,
                         CompositeMetadata rootMd,
                         QueryPlan searchQueryPlan,
                         QueryPlan retrievalQueryPlan,
                         CRUDOperationContext ctx); }
ExecutionPlan { public JsonNode toJson() { return resultStep.toJson(); } ExecutionPlan(QueryExpression requestQuery,
                         Projection requestProjection,
                         Sort requestSort,
                         Long from,
                         Long to,
                         CompositeMetadata rootMd,
                         QueryPlan searchQueryPlan,
                         QueryPlan retrievalQueryPlan,
                         CRUDOperationContext ctx); StepResult<ResultDocument> getResults(ExecutionContext ctx); static Projection writeProjection(Collection<Path> fields); static Set<Path> getIncludedFieldsOfEntityForSearch(ExecutionBlock block,
                                                               List<QueryFieldInfo> fieldInfo); static Set<Path> getIncludedFieldsOfEntityForProjection(ExecutionBlock block,
                                                                   CompositeMetadata root,
                                                                   Projection requestProjection); static Set<Path> getIncludedFieldsOfRootEntityForSort(CompositeMetadata root,
                                                                 Sort rootSort); static Set<Path> getIncludedFieldsOfEntityForSort(ExecutionBlock block); JsonNode toJson(); @Override String toString(); JsonNode explain(ExecutionContext ctx); }
ExecutionPlan { public JsonNode toJson() { return resultStep.toJson(); } ExecutionPlan(QueryExpression requestQuery,
                         Projection requestProjection,
                         Sort requestSort,
                         Long from,
                         Long to,
                         CompositeMetadata rootMd,
                         QueryPlan searchQueryPlan,
                         QueryPlan retrievalQueryPlan,
                         CRUDOperationContext ctx); StepResult<ResultDocument> getResults(ExecutionContext ctx); static Projection writeProjection(Collection<Path> fields); static Set<Path> getIncludedFieldsOfEntityForSearch(ExecutionBlock block,
                                                               List<QueryFieldInfo> fieldInfo); static Set<Path> getIncludedFieldsOfEntityForProjection(ExecutionBlock block,
                                                                   CompositeMetadata root,
                                                                   Projection requestProjection); static Set<Path> getIncludedFieldsOfRootEntityForSort(CompositeMetadata root,
                                                                 Sort rootSort); static Set<Path> getIncludedFieldsOfEntityForSort(ExecutionBlock block); JsonNode toJson(); @Override String toString(); JsonNode explain(ExecutionContext ctx);  }