Examples of DocList


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

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

      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

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

    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

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

        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

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

  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

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

          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

Examples of org.apache.solr.search.DocList

    List<Integer> docIds = getInts(params.getParams(TermVectorParams.DOC_IDS));
    Iterator<Integer> iter;
    if (docIds != null && !docIds.isEmpty()) {
      iter = docIds.iterator();
    } else {
      DocList list = listAndSet.docList;
      iter = list.iterator();
    }
    SolrIndexSearcher searcher = rb.req.getSearcher();

    IndexReader reader = searcher.getReader();
    //the TVMapper is a TermVectorMapper which can be used to optimize loading of Term Vectors
View Full Code Here

Examples of org.apache.solr.search.DocList

            true);
        int matchOffset = params.getInt(MoreLikeThisParams.MATCH_OFFSET, 0);
        // Find the base match
        Query query = QueryParsing.parseQuery(q, params.get(CommonParams.DF),
            params, req.getSchema());
        DocList match = searcher.getDocList(query, null, null, matchOffset, 1,
            flags); // only get the first one...
        if (includeMatch) {
          rsp.add("match", match);
        }

        // This is an iterator, but we only handle the first match
        DocIterator iterator = match.iterator();
        if (iterator.hasNext()) {
          // do a MoreLikeThis query for each document in results
          int id = iterator.nextDoc();
          mltDocs = mlt.getMoreLikeThis(id, start, rows, filters, interesting,
              flags);
View Full Code Here

Examples of org.apache.solr.search.DocList

        // level values in the NamedList are checked for DocLists.
        NamedList values = rsp.getValues();
        for (int i=0; i<values.size(); i++) {
          Object o = values.getVal(i);
          if (o instanceof DocList) {
            DocList docs = (DocList)o;
            for (DocIterator iter = docs.iterator(); iter.hasNext();) {
              newSearcher.doc(iter.nextDoc());
            }
          }
        }
View Full Code Here

Examples of org.apache.solr.search.DocList

          responseWriter.endDocumentList();
        } else {
          responseWriter.writeAllDocs(info, list);
        }
      } else if (val instanceof DocList) {
        DocList docList = (DocList) val;
        int sz = docList.size();
        IdxInfo idxInfo = new IdxInfo(request.getSchema(), request
            .getSearcher(), response.getReturnFields());
        DocListInfo info = new DocListInfo(docList.matches(), docList.size(),docList.offset(),
            docList.maxScore());
        DocIterator iterator = docList.iterator();
        if (responseWriter.isStreamingDocs()) {
          responseWriter.startDocumentList(name,info);
          for (int j = 0; j < sz; j++) {
            SolrDocument sdoc = getDoc(iterator.nextDoc(), idxInfo);
            if (idxInfo.includeScore && docList.hasScores()) {
              sdoc.addField(SCORE_FIELD, iterator.score());
            }
            responseWriter.writeDoc(sdoc);
          }
        } else {
          ArrayList<SolrDocument> list = new ArrayList<SolrDocument>(docList
              .size());
          for (int j = 0; j < sz; j++) {
            SolrDocument sdoc = getDoc(iterator.nextDoc(), idxInfo);
            if (idxInfo.includeScore && docList.hasScores()) {
              sdoc.addField(SCORE_FIELD, iterator.score());
            }
            list.add(sdoc);
          }
          responseWriter.writeAllDocs(info, list);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.