Package net.sf.clairv.index.util

Examples of net.sf.clairv.index.util.RemoteOneNodeList


                RemoteDocList docList = (RemoteDocList)itr1.next();
                sb.append(docList.term + " " + docList.idf
                    + "[");
                int i = 0;
                for (Iterator itr2 = docList.docList.iterator(); itr2.hasNext(); ) {
                  RemoteOneNodeList oneNodeList = (RemoteOneNodeList)itr2.next();
                  sb.append(oneNodeList.nodeid + "<");
                  int j = 0;
                  for (Iterator itr3 = oneNodeList.oneNodeDocList.iterator(); itr3.hasNext(); ) {
                    RemoteDoc doc = (RemoteDoc)itr3.next();
                    sb.append(doc.docid + "*" + doc.tf);
View Full Code Here


        list.term = token.nextToken();
        list.idf = Float.parseFloat(token.nextToken());

        oneTerm = oneTerm.substring(i + 1, oneTerm.length() - 1);
        token = new StringTokenizer(oneTerm, ":");
        RemoteOneNodeList nodeList = new RemoteOneNodeList();
        while (token.hasMoreTokens()) {
          String oneNodeList = token.nextToken();
          i = oneNodeList.indexOf("<");
          String nodeid = oneNodeList.substring(0, i);
          nodeList.nodeid = nodeid;
          token = new StringTokenizer(oneNodeList.substring(i + 1,
              oneNodeList.length() - 1), "|");
          while (token.hasMoreTokens()) {
            String oneDoc = token.nextToken();
            oneDoc = oneDoc.trim();
            StringTokenizer id_token = new StringTokenizer(oneDoc,
                "*");
            RemoteDoc doc = new RemoteDoc(Integer.parseInt(id_token
                .nextToken()), Float.parseFloat(id_token
                .nextToken()));
            nodeList.add(doc);
          }
          list.add(nodeList);
        }
        remoteInvertedIndex.add(list);
        oneTerm = br.readLine();
View Full Code Here

    int index = 0;
    for (; index < remoteInvertedIndex.size(); index++) {
      RemoteDocList list = (RemoteDocList)remoteInvertedIndex.get(index);
      if (term.equals(list.term)) {
        for (int i = 0; i < list.docList.size(); i++) {
          RemoteOneNodeList nodeList = list.get(i);
          if (nodeid.equals(nodeList.nodeid)) {
            Set oldSet = new TreeSet();
            oldSet.addAll(nodeList.oneNodeDocList);
            Set newSet = new TreeSet();
            newSet.addAll(doclist);
            if (oldSet.equals(newSet)) {
              list.remove(i);
              list.add(i, new RemoteOneNodeList(nodeid, doclist));
              return true;
            }
          }
        }
        return false;
      }
    }
    RemoteDocList newDocList = new RemoteDocList(term, getIdf(nodeid), null);
    newDocList.add(new RemoteOneNodeList(nodeid, doclist));
    remoteInvertedIndex.add(index, newDocList);
    return true;
  }
View Full Code Here

        String docListStr = Db.bt_Get(treeHandle, keyword);
        if (docListStr != null) {
          RemoteDocList docList = parseDocList(docListStr);
          boolean exist = false;
          for (Iterator itr = docList.docList.iterator(); itr.hasNext(); ) {
            RemoteOneNodeList oneNodeList = (RemoteOneNodeList)itr.next();
            if (sourceNodeId.equals(oneNodeList.nodeid)) {
              oneNodeList.add(list);
              exist = true;
            }
          }
          if (!exist) {
            docList.add(new RemoteOneNodeList(sourceNodeId, list));
            docList.idf = docList.idf + getIdf();
          }
          Db.bt_Rem(treeHandle, keyword);
          Db.bt_Put(treeHandle, keyword, parseString(docList));
        } else {
View Full Code Here

    docList.term = token.nextToken();
    docList.idf = Float.parseFloat(token.nextToken());

    docListStr = docListStr.substring(i + 1, docListStr.length() - 1);
    token = new StringTokenizer(docListStr, ":");
    RemoteOneNodeList nodeList = new RemoteOneNodeList();
    while (token.hasMoreTokens()) {
      String oneNodeList = token.nextToken();
      i = oneNodeList.indexOf("<");
      String nodeid = oneNodeList.substring(0, i);
      nodeList.nodeid = nodeid;
      token = new StringTokenizer(oneNodeList.substring(i + 1,
          oneNodeList.length() - 1), "|");
      while (token.hasMoreTokens()) {
        String oneDoc = token.nextToken();
        oneDoc = oneDoc.trim();
        StringTokenizer id_token = new StringTokenizer(oneDoc, "*");
        RemoteDoc doc = new RemoteDoc(Integer.parseInt(id_token
            .nextToken()), Float.parseFloat(id_token.nextToken()));
        nodeList.add(doc);
      }
      docList.add(nodeList);
    }
    return docList;
  }
View Full Code Here

  }

  private String parseString(String keyword, String sourceNodeId,
      List list) {
    RemoteDocList docList = new RemoteDocList(keyword, getIdf());
    RemoteOneNodeList oneNodeList = new RemoteOneNodeList(sourceNodeId,
        list);
    docList.add(oneNodeList);
    return parseString(docList);
  }
View Full Code Here

  private String parseString(RemoteDocList docList) {
    StringBuffer sb = new StringBuffer();
    sb.append(docList.term + " " + docList.idf + "[");
    int i = 0;
    for (Iterator itr1 = docList.docList.iterator(); itr1.hasNext(); ) {
      RemoteOneNodeList oneNodeList = (RemoteOneNodeList)itr1.next();
      sb.append(oneNodeList.nodeid + "<");
      int j = 0;
      for (Iterator itr2 = oneNodeList.oneNodeDocList.iterator(); itr2.hasNext();) {
        RemoteDoc doc = (RemoteDoc) itr2.next();
        sb.append(doc.docid + "*" + doc.tf);
View Full Code Here

          if (rs.next()) {
            RemoteDocList docList = parseDocList(rs
                .getString("list"));
            boolean exist = false;
            for (Iterator itr = docList.docList.iterator(); itr.hasNext(); ) {
              RemoteOneNodeList oneNodeList = (RemoteOneNodeList)itr.next();
              if (sourceNodeId.equals(oneNodeList.nodeid)) {
                oneNodeList.add(list);
                exist = true;
              }
            }
            if (!exist) {
              docList.add(new RemoteOneNodeList(sourceNodeId,
                  list));
              docList.idf = docList.idf + getIdf();
            }
            // updateStatement.setString(1, parseString(docList));
            // updateStatement.setString(2, keyword);
            // updateStatement.addBatch();
            commitBatchThread.addJob(new BatchJob(keyword, docList,
                false));
          } else {
            // insertStatement.setString(1, keyword);
            // insertStatement.setString(2, parseString(keyword,
            // sourceNodeId, list));
            // insertStatement.addBatch();
            RemoteDocList l = new RemoteDocList(keyword, getIdf());
            RemoteOneNodeList oneNodeList = new RemoteOneNodeList(
                sourceNodeId, list);
            l.add(oneNodeList);
            commitBatchThread
                .addJob(new BatchJob(keyword, l, true));
          }
View Full Code Here

    docList.term = token.nextToken();
    docList.idf = Float.parseFloat(token.nextToken());

    docListStr = docListStr.substring(i + 1, docListStr.length() - 1);
    token = new StringTokenizer(docListStr, ":");
    RemoteOneNodeList nodeList = new RemoteOneNodeList();
    while (token.hasMoreTokens()) {
      String oneNodeList = token.nextToken();
      i = oneNodeList.indexOf("<");
      String nodeid = oneNodeList.substring(0, i);
      nodeList.nodeid = nodeid;
      token = new StringTokenizer(oneNodeList.substring(i + 1,
          oneNodeList.length() - 1), "|");
      while (token.hasMoreTokens()) {
        String oneDoc = token.nextToken();
        oneDoc = oneDoc.trim();
        StringTokenizer id_token = new StringTokenizer(oneDoc, "*");
        RemoteDoc doc = new RemoteDoc(Integer.parseInt(id_token
            .nextToken()), Float.parseFloat(id_token.nextToken()));
        nodeList.add(doc);
      }
      docList.add(nodeList);
    }
    return docList;
  }
View Full Code Here

  private String parseString(RemoteDocList docList) {
    StringBuffer sb = new StringBuffer();
    sb.append(docList.term + " " + docList.idf + "[");
    int i = 0;
    for (Iterator itr1 = docList.docList.iterator(); itr1.hasNext();) {
      RemoteOneNodeList oneNodeList = (RemoteOneNodeList)itr1.next();
      sb.append(oneNodeList.nodeid + "<");
      int j = 0;
      for (Iterator itr2 = oneNodeList.oneNodeDocList.iterator(); itr2.hasNext(); ) {
        RemoteDoc doc = (RemoteDoc) itr2.next();
        sb.append(doc.docid + "*" + doc.tf);
View Full Code Here

TOP

Related Classes of net.sf.clairv.index.util.RemoteOneNodeList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.