@Test void testMetallica() { Chain<Searcher> myChain = new Chain<>(new MinimalQueryInserter(), new EquivSearcher()); Execution.Context context = Execution.Context.createContextStub(); Execution execution = new Execution(myChain, context); for (String yql: queries) { Query query = new Query("/search/?yql=" + encode(yql, StandardCharsets.UTF_8)); query.setTraceLevel(6); Result result = execution.search(query); System.out.println(result.getContext(false).getTrace()); } }
@Override public Result search(Query query, Execution execution) { query.trace("Before equivize:" + query.toDetailString(), false, 6); QueryTree tree = query.getModel().getQueryTree(); Item rootItem = tree.getRoot(); rootItem = equivize(rootItem); tree.setRoot(rootItem); query.trace("After equivize:" + query.toDetailString(), false, 6); return execution.search(query); }
EquivSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { query.trace("Before equivize:" + query.toDetailString(), false, 6); QueryTree tree = query.getModel().getQueryTree(); Item rootItem = tree.getRoot(); rootItem = equivize(rootItem); tree.setRoot(rootItem); query.trace("After equivize:" + query.toDetailString(), false, 6); return execution.search(query); } }
EquivSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { query.trace("Before equivize:" + query.toDetailString(), false, 6); QueryTree tree = query.getModel().getQueryTree(); Item rootItem = tree.getRoot(); rootItem = equivize(rootItem); tree.setRoot(rootItem); query.trace("After equivize:" + query.toDetailString(), false, 6); return execution.search(query); }  }
EquivSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { query.trace("Before equivize:" + query.toDetailString(), false, 6); QueryTree tree = query.getModel().getQueryTree(); Item rootItem = tree.getRoot(); rootItem = equivize(rootItem); tree.setRoot(rootItem); query.trace("After equivize:" + query.toDetailString(), false, 6); return execution.search(query); }  @Override Result search(Query query, Execution execution); }
EquivSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { query.trace("Before equivize:" + query.toDetailString(), false, 6); QueryTree tree = query.getModel().getQueryTree(); Item rootItem = tree.getRoot(); rootItem = equivize(rootItem); tree.setRoot(rootItem); query.trace("After equivize:" + query.toDetailString(), false, 6); return execution.search(query); }  @Override Result search(Query query, Execution execution);  }