Package org.apache.lucene.util

Examples of org.apache.lucene.util.PriorityQueue.pop()


    ArrayList al = new ArrayList( maxQueryTerms);
    PriorityQueue pq = retrieveTerms(docNum);
    Object cur;
    int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
    // we just want to return the top words
    while (((cur = pq.pop()) != null) && lim-- > 0) {
            Object[] ar = (Object[]) cur;
      al.add( ar[ 0]); // the 1st entry is the interesting word
    }
    String[] res = new String[ al.size()];
    return (String[]) al.toArray( res);
View Full Code Here


    ArrayList al = new ArrayList( maxQueryTerms);
    PriorityQueue pq = retrieveTerms( r);
    Object cur;
    int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
    // we just want to return the top words
    while (((cur = pq.pop()) != null) && lim-- > 0) {
            Object[] ar = (Object[]) cur;
      al.add( ar[ 0]); // the 1st entry is the interesting word
    }
    String[] res = new String[ al.size()];
    return (String[]) al.toArray( res);
View Full Code Here

      ir.close();
    }
    String res[] = new String[pq.size()];
    int i = 0;
    while (pq.size()>0) {
      TermDf tdf = (TermDf) pq.pop();
      res[i++] = tdf.word;
      System.out.println(i+".   word:  "+tdf.df+"   "+tdf.word);
    }
    return res;
  }
View Full Code Here

    ArrayList al = new ArrayList( maxQueryTerms);
    PriorityQueue pq = retrieveTerms(docNum);
    Object cur;
    int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
    // we just want to return the top words
    while (((cur = pq.pop()) != null) && lim-- > 0) {
            Object[] ar = (Object[]) cur;
      al.add( ar[ 0]); // the 1st entry is the interesting word
    }
    String[] res = new String[ al.size()];
    return (String[]) al.toArray( res);
View Full Code Here

    ArrayList al = new ArrayList( maxQueryTerms);
    PriorityQueue pq = retrieveTerms( r);
    Object cur;
    int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
    // we just want to return the top words
    while (((cur = pq.pop()) != null) && lim-- > 0) {
            Object[] ar = (Object[]) cur;
      al.add( ar[ 0]); // the 1st entry is the interesting word
    }
    String[] res = new String[ al.size()];
    return (String[]) al.toArray( res);
View Full Code Here

        PriorityQueue pq = retrieveTerms(docNum);
        Object cur;
        // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
        int lim = maxQueryTerms;
        // we just want to return the top words
        while (((cur = pq.pop()) != null) && lim-- > 0) {
            Object[] ar = (Object[]) cur;
            al.add(ar[0]); // the 1st entry is the interesting word
        }
        String[] res = new String[al.size()];
        return (String[]) al.toArray(res);
View Full Code Here

        PriorityQueue pq = retrieveTerms(r);
        Object cur;
        // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
        int lim = maxQueryTerms;
        // we just want to return the top words
        while (((cur = pq.pop()) != null) && lim-- > 0) {
            Object[] ar = (Object[]) cur;
            al.add(ar[0]); // the 1st entry is the interesting word
        }
        String[] res = new String[al.size()];
        return (String[]) al.toArray(res);
View Full Code Here

      // retrieve fragment infos from queue and fill into list, least
      // fragment comes out first
      List infos = new LinkedList();
      while (bestFragments.size() > 0)
      {
         FragmentInfo fi = (FragmentInfo)bestFragments.pop();
         infos.add(0, fi);
      }

      Map offsetInfos = new IdentityHashMap();
      // remove overlapping fragment infos
View Full Code Here

          }
        }
        // at this point, queue contains top maxCnt facets that have hitcount >= minHits
        while (qsize-- > 0) {
          // append each entry to the beginning of the facet list to order facets by hits descending
          list.addFirst((BrowseFacet) queue.pop());
        }
      } else {
        // no maxCnt specified. So fetch all facets according to minHits and sort them later
        while ((facet = iter.next(minHits)) != null)
          list.add(new BrowseFacet(String.valueOf(facet), iter.count));
View Full Code Here

            browseFacet = (BrowseFacet) queue.insertWithOverflow(browseFacet);
          }
        }
        // remove from queue and add to the list
        while (qsize-- > 0)
          list.addFirst((BrowseFacet) queue.pop());
      } else {
        // order by custom but no max count supplied
        while ((facet = iter.next(minHits)) != null)
          list.add(new BrowseFacet(String.valueOf(facet), iter.count));
        Collections.sort(list, comparator);
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.