Examples of TermStatsQueue


Examples of com.tistory.devyongsik.crescent.admin.entity.HighFreqTermResult.TermStatsQueue

        indexInfo.setTotalTermCount(totalTermCount);
       
        try {
     
          HighFreqTermResult highFreqTermResult = getHighFreqTerms(selectCollection);
      TermStatsQueue q = highFreqTermResult.getTermStatsQueue();
     
      List<CrescentTermStats> crescentTermStatsList = new ArrayList<CrescentTermStats>();
     
      while(q.size() > 0) {
        CrescentTermStats stats = q.pop();
       
        crescentTermStatsList.add(stats);
      }
     
      Collections.sort(crescentTermStatsList, new Comparator<CrescentTermStats>() {
View Full Code Here

Examples of org.xbib.elasticsearch.skywalker.stats.TermStatsQueue

    }

    private static final TermStats[] EMPTY_STATS = new TermStats[0];

    public TermStats[] getHighFreqTerms(int numTerms, String[] fieldNames) {
        TermStatsQueue tiq = new TermStatsQueue(numTerms);
        TermsEnum te = null;
        try {
            if (fieldNames != null) {
                Fields fields = MultiFields.getFields(reader);
                if (fields == null) {
                    return EMPTY_STATS;
                }
                for (String field : fieldNames) {
                    Terms terms = fields.terms(field);
                    if (terms != null) {
                        te = terms.iterator(te);
                        fillQueue(te, tiq, field);
                    }
                }
            } else {
                Fields fields = MultiFields.getFields(reader);
                if (fields == null) {
                    return EMPTY_STATS;
                }
                for (String field : fields) {
                    Terms terms = fields.terms(field);
                    te = terms.iterator(te);
                    fillQueue(te, tiq, field);
                }
            }
        } catch (IOException e) {
            // ignore
        }
        TermStats[] result = new TermStats[tiq.size()];
        // we want highest first so we read the queue and populate the array
        // starting at the end and work backwards
        int count = tiq.size() - 1;
        while (tiq.size() != 0) {
            result[count] = tiq.pop();
            count--;
        }
        return result;
    }
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.