@Test void testAddedOrTerm2() { try (Application app = Application.fromApplicationPackage( FileSystems.getDefault().getPath("src/main/application"), Networking.disable)) { Search search = app.getJDisc("default").search(); Result result = search.process(ComponentSpecification.fromString("metalchain"), metalQuery); System.out.println(result.getContext(false).getTrace()); assertAddedOrTerm(metalQuery.getModel().getQueryTree().getRoot()); } }
@Override public Result search(Query query, Execution execution) { QueryTree tree = query.getModel().getQueryTree(); if (isMetalQuery(tree)) { OrItem orItem = new OrItem(); orItem.addItem(tree.getRoot()); orItem.addItem(new WordItem("metal", "album")); tree.setRoot(orItem); query.trace("Metal added", true, 2); } return execution.search(query); }
MetalSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { QueryTree tree = query.getModel().getQueryTree(); if (isMetalQuery(tree)) { OrItem orItem = new OrItem(); orItem.addItem(tree.getRoot()); orItem.addItem(new WordItem("metal", "album")); tree.setRoot(orItem); query.trace("Metal added", true, 2); } return execution.search(query); } }
MetalSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { QueryTree tree = query.getModel().getQueryTree(); if (isMetalQuery(tree)) { OrItem orItem = new OrItem(); orItem.addItem(tree.getRoot()); orItem.addItem(new WordItem("metal", "album")); tree.setRoot(orItem); query.trace("Metal added", true, 2); } return execution.search(query); } @Inject  MetalSearcher(MetalNamesConfig config);  MetalSearcher(); }
MetalSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { QueryTree tree = query.getModel().getQueryTree(); if (isMetalQuery(tree)) { OrItem orItem = new OrItem(); orItem.addItem(tree.getRoot()); orItem.addItem(new WordItem("metal", "album")); tree.setRoot(orItem); query.trace("Metal added", true, 2); } return execution.search(query); } @Inject  MetalSearcher(MetalNamesConfig config);  MetalSearcher(); @Override Result search(Query query, Execution execution); }
MetalSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { QueryTree tree = query.getModel().getQueryTree(); if (isMetalQuery(tree)) { OrItem orItem = new OrItem(); orItem.addItem(tree.getRoot()); orItem.addItem(new WordItem("metal", "album")); tree.setRoot(orItem); query.trace("Metal added", true, 2); } return execution.search(query); } @Inject  MetalSearcher(MetalNamesConfig config);  MetalSearcher(); @Override Result search(Query query, Execution execution);  }