private XFacetedQuery XML2Query(Document doc) { try { Node node = null; NamedNodeMap map = null; node = doc.getElementsByTagName("action").item(0); map = node.getAttributes(); // create XFacetedQuery node = doc.getElementsByTagName("targetNode").item(0); map = node.getAttributes(); int target = new Integer(map.getNamedItem("index").getNodeValue()).intValue(); CatRelGraph graph = schemaFactory.createCatRelGraph(); node = doc.getElementsByTagName("queryNode").item(0); graph.add(createGeneralCategory(node)); // System.out.println("name="+node.getNodeName()); addRelations(graph, 0, node.getChildNodes()); System.out.println(graph); System.out.println("target=" + target); XFacetedQuery query = searchFactory.createXFacetedQuery(); query.setSearchTarget(target); query.setQueryConstraint(graph); query.setResultSpec(searchFactory.createXFacetedResultSpec()); return query; } catch (Exception ex) { ex.printStackTrace(); } return null; }
public void init(String configFile) throws Exception { Properties config = Config.readConfigFile(configFile); XFacetedSearchService searchService = searchFactory.getXFacetedSearchService(config); searcher = searchService.getXFacetedSearchable(); }