public static String processSingleQuery(String line, BPlusTree bTree) { URLList queryResult = bTree.getURLs(line.hashCode()); if (queryResult != null) { return Searcher.getURLString(queryResult); } else { return "The word \"" + line + "\" has NOT been found."; } }
public static String processAnd(StringTokenizer tokenizer, BPlusTree bTree) { String x = tokenizer.nextToken(); String y = tokenizer.nextToken(); x = trimSpaces(x); y = trimSpaces(y); URLList commonURLs = findCommonURLs(x, y, bTree); return Searcher.getURLString(commonURLs); }
public static String processOr(StringTokenizer tokenizer, BPlusTree bTree) { String x = tokenizer.nextToken(); String y = tokenizer.nextToken(); x = trimSpaces(x); y = trimSpaces(y); URLList xURLs = bTree.getURLs(x.hashCode()); URLList yURLs = bTree.getURLs(y.hashCode()); URLList current = xURLs; while (current.next != null) { current = current.next; } current.next = yURLs; return Searcher.getURLString(xURLs); }