Ejemplo n.º 1
0
  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.";
    }
  }
Ejemplo n.º 2
0
  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);
  }
Ejemplo n.º 3
0
  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);
  }