Package net.sf.clairv.search.util

Examples of net.sf.clairv.search.util.DocList


    final Counter counter = new Counter(1);

    final KeywordQueryMessage kqm = (KeywordQueryMessage) request
        .getMessage();

    final DocList docList = reader.getMatchList(kqm.getKeywords()[kqm
        .getCurrentKeywordIndex()]);

    idf = reader.getIdf();

    final ScoreDocList sdList = new ScoreDocList(docList);
View Full Code Here


      log.error("Inverted list db does not exist");
    }
  }

  private DocList parseDocList(String docListStr) {
    DocList docList = new DocList();
    docListStr = docListStr.trim();
    int i = docListStr.indexOf("[");
    StringTokenizer token = new StringTokenizer(docListStr.substring(0, i));
    docList.term = token.nextToken();
    docList.idf = Float.parseFloat(token.nextToken());

    docListStr = docListStr.substring(i + 1, docListStr.length() - 1);
    token = new StringTokenizer(docListStr, ":");
    OneNodeList nodeList = new OneNodeList();
    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, "*");
        Doc doc = new Doc(Integer.parseInt(id_token.nextToken()), Float
            .parseFloat(id_token.nextToken()));
        nodeList.add(doc);
      }
      docList.add(nodeList);
    }
    return docList;
  }
View Full Code Here

    lock.lock();
    try {
      if (treeHandle != null) {
        String docListStr = Db.bt_Get(treeHandle, keyword);
        if (docListStr != null) {
          DocList result = parseDocList(docListStr);
          idf = result.idf;
          return result;
        } else {
          log.debug("Can not find the keyword : " + keyword);
        }
View Full Code Here

        token = new StringTokenizer(oneTerm.substring(0, i));
        String keyword = token.nextToken();
        idf = Float.parseFloat(token.nextToken());
        if (term.equals(keyword)) {
          log.debug("Start ");
          DocList list = new DocList();
          list.term = keyword;
          list.idf = idf;
          oneTerm = oneTerm.substring(i + 1, oneTerm.length() - 1);
          token = new StringTokenizer(oneTerm, ":");
          OneNodeList nodeList = new OneNodeList();
          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, "*");
              Doc doc = new Doc(Integer.parseInt(id_token
                  .nextToken()), Float.parseFloat(id_token
                  .nextToken()));
              nodeList.add(doc);
            }
            list.add(nodeList);
          }
          return list;
        }
        oneTerm = br.readLine();
      }
View Full Code Here

  public float getIdf() {
    return 1;
  }

  private DocList parseDocList(String docListStr) {
    DocList docList = new DocList();
    docListStr = docListStr.trim();
    int i = docListStr.indexOf("[");
    StringTokenizer token = new StringTokenizer(docListStr.substring(0, i));
    docList.term = token.nextToken();
    docList.idf = Float.parseFloat(token.nextToken());

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

          queryStatement.setString(1, keyword);
          ResultSet rs = queryStatement.executeQuery();
          if (rs.next()) {
            String docListStr = rs.getString("list");
            if (docListStr != null) {
              DocList result = parseDocList(docListStr);
              return result;
            }
          } else {
            log.debug("Can not find the keyword : " + keyword);
          }
View Full Code Here

TOP

Related Classes of net.sf.clairv.search.util.DocList

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.